Rules
in package
A class that supports rules for statuses.
Table of Contents
- CONDITION_ALL_RECORDS_EQUAL = 'allRecordsEqual'
- Check if the elements of the input array are equal to the value.
- CONDITION_IS_EXIST = 'isExist'
- Check if the value in the input array exists.
- CONDITION_NO_RECORDS = 'noRecords'
- Check if the input array is empty.
- CONDITION_NOT_ALL_RECORDS_EQUAL = 'notAllRecordsEqual'
- Check if the elements of the input array are not equal to the value.
- CONDITION_NOT_IS_EXIST = 'notIsExist'
- Check if the value in the input array does not exist.
- CONDITION_NOT_NO_RECORDS = 'notNoRecords'
- Check if the input array is not empty.
- CONDITION_NOT_ONLY_CONTAINS = 'notOnlyContains'
- Check the input array does not contain values.
- CONDITION_ONLY_CONTAINS = 'onlyContains'
- Check the input array contains values.
- $config : array<string|int, mixed>
- Rules configuration.
- $defaultValue : mixed
- The default value is returned if the rules do not specify this case.
- __construct() : mixed
- Constructor.
- getValue() : mixed
- Get value.
- check() : bool
- Check rules.
- checkOperator() : bool
- Check the condition.
- operatorAllRecordsEqual() : bool
- Check the condition all are equal.
- operatorIsExist() : bool
- Check the condition if it exists in the array.
- operatorNoRecords() : bool
- Check the condition that the array is empty.
- operatorOnlyContains() : bool
- Check condition only contains.
- isNegation() : bool
- Check if there is a negation operator.
Constants
CONDITION_ALL_RECORDS_EQUAL
Check if the elements of the input array are equal to the value.
public
mixed
CONDITION_ALL_RECORDS_EQUAL
= 'allRecordsEqual'
CONDITION_IS_EXIST
Check if the value in the input array exists.
public
mixed
CONDITION_IS_EXIST
= 'isExist'
CONDITION_NO_RECORDS
Check if the input array is empty.
public
mixed
CONDITION_NO_RECORDS
= 'noRecords'
CONDITION_NOT_ALL_RECORDS_EQUAL
Check if the elements of the input array are not equal to the value.
public
mixed
CONDITION_NOT_ALL_RECORDS_EQUAL
= 'notAllRecordsEqual'
CONDITION_NOT_IS_EXIST
Check if the value in the input array does not exist.
public
mixed
CONDITION_NOT_IS_EXIST
= 'notIsExist'
CONDITION_NOT_NO_RECORDS
Check if the input array is not empty.
public
mixed
CONDITION_NOT_NO_RECORDS
= 'notNoRecords'
CONDITION_NOT_ONLY_CONTAINS
Check the input array does not contain values.
public
mixed
CONDITION_NOT_ONLY_CONTAINS
= 'notOnlyContains'
CONDITION_ONLY_CONTAINS
Check the input array contains values.
public
mixed
CONDITION_ONLY_CONTAINS
= 'onlyContains'
Properties
$config
Rules configuration.
private
array<string|int, mixed>
$config
= []
$defaultValue
The default value is returned if the rules do not specify this case.
private
mixed
$defaultValue
Methods
__construct()
Constructor.
public
__construct(array<string|int, mixed> $config[, mixed $defaultValue = false ]) : mixed
Parameters
- $config : array<string|int, mixed>
- $defaultValue : mixed = false
Return values
mixed —getValue()
Get value.
public
getValue(array<string|int, mixed> $items) : mixed
Parameters
- $items : array<string|int, mixed>
Return values
mixed —check()
Check rules.
protected
check(array<string|int, mixed> $items, array<string|int, mixed> $params) : bool
Parameters
- $items : array<string|int, mixed>
- $params : array<string|int, mixed>
Return values
bool —checkOperator()
Check the condition.
protected
checkOperator(string $operator, array<string|int, mixed> $items, mixed $val) : bool
Parameters
- $operator : string
- $items : array<string|int, mixed>
- $val : mixed
Return values
bool —operatorAllRecordsEqual()
Check the condition all are equal.
protected
operatorAllRecordsEqual(array<string|int, mixed> $items, mixed $valueOfCondition) : bool
Parameters
- $items : array<string|int, mixed>
- $valueOfCondition : mixed
Return values
bool —operatorIsExist()
Check the condition if it exists in the array.
protected
operatorIsExist(array<string|int, mixed> $items, mixed $valueOfCondition) : bool
Parameters
- $items : array<string|int, mixed>
- $valueOfCondition : mixed
Return values
bool —operatorNoRecords()
Check the condition that the array is empty.
protected
operatorNoRecords(array<string|int, mixed> $items) : bool
Parameters
- $items : array<string|int, mixed>
Return values
bool —operatorOnlyContains()
Check condition only contains.
protected
operatorOnlyContains(array<string|int, mixed> $items, mixed $valueOfCondition) : bool
Parameters
- $items : array<string|int, mixed>
- $valueOfCondition : mixed
Return values
bool —isNegation()
Check if there is a negation operator.
private
isNegation(string $operator) : bool
Parameters
- $operator : string