Documentation

PredicateCombinator extends Predicate

Enable filtering a record based on its value and/or its offset.

Tags
phpstan-type

Condition Predicate|Closure(mixed, array-key): bool

phpstan-type

ConditionExtended Predicate|Closure(mixed, array-key): bool|callable(mixed, array-key): bool

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
bool

and()

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
self

filter()

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
see
Predicate::__invoke
Return values
Iterator

not()

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
self

or()

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
self

xor()

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
Return values
self

        
On this page

Search results