PredicateCombinator
extends
Predicate
in
Enable filtering a record based on its value and/or its offset.
Tags
Table of Contents
Methods
- __invoke() : bool
- The class predicate method.
- and() : self
- Return an instance with the specified predicates joined together and with the current predicate using the AND Logical operator.
- filter() : Iterator
- Filters elements of an iterable structure using the class predicate method.
- not() : self
- Return an instance with the specified predicates joined together and with the current predicate using the NOT Logical operator.
- or() : self
- Return an instance with the specified predicates joined together and with the current predicate using the OR Logical operator.
- xor() : self
- Return an instance with the specified predicates joined together and with the current predicate using the XOR Logical operator.
Methods
__invoke()
The class predicate method.
public
__invoke(mixed $value, string|int $key) : bool
Evaluates each element of an iterable structure based on its value and its offset. The method must return true if the predicate is satisfied, false otherwise.
Parameters
- $value : mixed
- $key : string|int
Return values
booland()
Return an instance with the specified predicates joined together and with the current predicate using the AND Logical operator.
public
and(Condition ...$predicates) : self
This method MUST retain the state of the current instance, and return an instance that contains the specified changes.
Parameters
- $predicates : Condition
Return values
selffilter()
Filters elements of an iterable structure using the class predicate method.
public
filter(iterable<string|int, mixed> $value) : Iterator
Parameters
- $value : iterable<string|int, mixed>
Tags
Return values
Iteratornot()
Return an instance with the specified predicates joined together and with the current predicate using the NOT Logical operator.
public
not(Condition ...$predicates) : self
This method MUST retain the state of the current instance, and return an instance that contains the specified changes.
Parameters
- $predicates : Condition
Return values
selfor()
Return an instance with the specified predicates joined together and with the current predicate using the OR Logical operator.
public
or(Condition ...$predicates) : self
This method MUST retain the state of the current instance, and return an instance that contains the specified changes.
Parameters
- $predicates : Condition
Return values
selfxor()
Return an instance with the specified predicates joined together and with the current predicate using the XOR Logical operator.
public
xor(Condition ...$predicates) : self
This method MUST retain the state of the current instance, and return an instance that contains the specified changes.
Parameters
- $predicates : Condition