Rule
in package
implements
ArrayAccess
uses
ArrayAccessHelper
Represents a sorting rule that can be applied to incoming personal messages.
Table of Contents
Interfaces
- ArrayAccess
Constants
- LIMITS = ['criteria' => 10, 'actions' => 10]
- Maximum number of criteria and actions allowed per rule.
- RULE_AND = false
- Whether a rule's criteria are combined using AND or OR logic.
- RULE_OR = true
Properties
- $actions : array<string|int, mixed>
- $criteria : array<string|int, mixed>
- $delete : bool
- $id : int
- $loaded : array<string|int, mixed>
- $logic : bool
- $member : int
- $name : string
- $prop_aliases : array<string|int, mixed>
Methods
- __construct() : mixed
- Constructor.
- apply() : void
- This will apply rules to all unread messages.
- delete() : void
- Deletes the given rules from the database.
- load() : array<string|int, mixed>
- Loads all the rules for the current user.
- manage() : void
- List all rules, and allow adding, editing, etc.
- offsetExists() : bool
- Checks whether a property has been set when object is accessed as an array.
- offsetGet() : mixed
- Gets properties when object is accessed as an array.
- offsetSet() : void
- Sets properties when object is accessed as an array.
- offsetUnset() : void
- Unsets properties when object is accessed as an array.
- save() : void
- Save this rule to the database.
Constants
LIMITS
Maximum number of criteria and actions allowed per rule.
public
mixed
LIMITS
= ['criteria' => 10, 'actions' => 10]
RULE_AND
Whether a rule's criteria are combined using AND or OR logic.
public
mixed
RULE_AND
= false
RULE_OR
public
mixed
RULE_OR
= true
Properties
$actions
public
array<string|int, mixed>
$actions
= []
Actions that this rule performs.
$criteria
public
array<string|int, mixed>
$criteria
= []
This rule's criteria.
$delete
public
bool
$delete
= false
Whether this rule deletes PMs.
$id
public
int
$id
This rule's ID number.
$loaded
public
static array<string|int, mixed>
$loaded
= []
All loaded instances of this class.
$logic
public
bool
$logic
= self::RULE_AND
Whether to combine this rule with others using OR logic or AND logic. Either self::RULE_AND or self::RULE_OR.
$member
public
int
$member
ID number of the member that this rule belongs to.
$name
public
string
$name
= ''
This rule's name.
$prop_aliases
protected
array<string|int, mixed>
$prop_aliases
= ['id_rule' => 'id', 'id_member' => 'member', 'rule_name' => 'name', 'delete_pm' => 'delete', 'is_or' => 'logic']
Alternate names for some object properties.
Methods
__construct()
Constructor.
public
__construct([array<string|int, mixed> $props = [] ]) : mixed
Parameters
- $props : array<string|int, mixed> = []
-
Properties to set for this rule.
apply()
This will apply rules to all unread messages.
public
static apply([bool $all_messages = false ]) : void
If $all_messages is set will, obviously, do it to all!
Parameters
- $all_messages : bool = false
-
Whether to apply this to all messages or just unread ones.
delete()
Deletes the given rules from the database.
public
static delete(array<string|int, mixed> $ids) : void
Parameters
- $ids : array<string|int, mixed>
-
IDs of the rules to delete.
load()
Loads all the rules for the current user.
public
static load([bool $reload = false ]) : array<string|int, mixed>
Parameters
- $reload : bool = false
-
If true, force a reload.
Return values
array<string|int, mixed>manage()
List all rules, and allow adding, editing, etc.
public
static manage() : void
..
offsetExists()
Checks whether a property has been set when object is accessed as an array.
public
offsetExists(mixed $prop) : bool
Parameters
- $prop : mixed
-
The property name.
Return values
booloffsetGet()
Gets properties when object is accessed as an array.
public
& offsetGet(mixed $prop) : mixed
Parameters
- $prop : mixed
-
The property name.
Return values
mixed —A reference to the property.
offsetSet()
Sets properties when object is accessed as an array.
public
offsetSet(mixed $prop, mixed $value) : void
Parameters
- $prop : mixed
-
The property name.
- $value : mixed
-
The value to set.
offsetUnset()
Unsets properties when object is accessed as an array.
public
offsetUnset(mixed $prop) : void
Parameters
- $prop : mixed
-
The property name.
save()
Save this rule to the database.
public
save() : void