FilterGroup
MMO\core\helpers · 1 symbol · generated 30 Sep 2026
FilterGroup
Filter.php:325A group of filters (or nested groups) combined with GroupOperator (AND/OR/NOR).
Index
| content | ||
| operator | ||
| add($asserts) | Append member filters/groups. | |
| and($args) | Add $args, combined with AND. | |
| clear() | ||
| count() | ||
| getContent() | ||
| getIterator() | \IteratorAggregate::getIterator | |
| has($path) | ||
| isEmpty() | ||
| jsonSerialize() | ||
| keys() | ||
| loadArray($data) | Load every entry of a plain array into the content, through offsetSet (so any offsetSet() override defined by the class using this trait, e.g. | |
| loopByPath($path) | Recursively find every member Filter (at any nesting depth) that has a condition on $path. | |
| nor($args) | Same as and, but combining with NOR (none of $args may match). | |
| offsetExists($key) | \ArrayAccess::offsetExists | |
| offsetGet($key) | \ArrayAccess::offsetGet | |
| offsetSet($key, $value) | \ArrayAccess::offsetSet -- a null $key appends ($bag[] = $value), like a plain PHP array. | |
| offsetUnset($key) | \ArrayAccess::offsetUnset -- on a list (sequential integer keys, as produced by $bag[] = ...), the element is spliced out (closing the gap and reindexing), matching \unset() semantics on a plain … | |
| or($args) | Same as and, but combining with OR. | |
| simplify() | Recursively simplify: merges sibling AND-combined single-Filter members that don't share any path into one Filter (fewer, more compact conditions with identical semantics), and collapses a group do… | |
| test($data, $schema) | ||
| toArray() | ||
| toClosure($data, $schema) | ||
| __clone() | ||
| __construct($operator, $args) | ||
| __toString() |
Properties2
content
operator
- Type
- GroupOperator
Methods25
add($asserts)
Filter.php:440Append member filters/groups. An empty array is silently skipped.
and($args)
Filter.php:381Add $args, combined with AND. If this group is already an AND group, they're added directly to it (returning $this); otherwise a new nested AND subgroup is created and added instead (returning the subgroup).
clear()
Filter.php:346| returns | void | empty this group |
count()
Filter.php:427| returns | int | total number of leaf conditions, recursively (a nested group's own count is added, not counted as 1) |
getContent()
Filter.php:351| returns | array | raw list of member filters/groups |
getIterator()
tArray.php:97\IteratorAggregate::getIterator
| returns | Traversable |
has($path)
Filter.php:368isEmpty()
tArray.php:33| returns | true if the underlying content has no elements |
jsonSerialize()
Filter.php:467keys()
tArray.php:82| returns | array | the list of keys currently set |
loadArray($data)
tArray.php:71Load every entry of a plain array into the content, through offsetSet (so any offsetSet() override defined by the class using this trait, e.g. for validation or type coercion, is honored for every entry).
loopByPath($path)
Filter.php:360Recursively find every member Filter (at any nesting depth) that has a condition on $path.
nor($args)
Filter.php:405Same as and, but combining with NOR (none of $args may match).
offsetExists($key)
tArray.php:130\ArrayAccess::offsetExists
offsetGet($key)
tArray.php:115\ArrayAccess::offsetGet
offsetSet($key, $value)
tArray.php:122\ArrayAccess::offsetSet -- a null $key appends ($bag[] = $value), like a plain PHP array.
offsetUnset($key)
tArray.php:107\ArrayAccess::offsetUnset -- on a list (sequential integer keys, as produced by $bag[] = ...), the element is spliced out (closing the gap and reindexing), matching \unset() semantics on a plain PHP list; on an associative array, the key is simply removed.
or($args)
Filter.php:393Same as and, but combining with OR.
simplify()
Filter.php:478Recursively simplify: merges sibling AND-combined single-Filter members that don't share any path into one Filter (fewer, more compact conditions with identical semantics), and collapses a group down to its sole member if it ends up with just one (except a NOR group, which must keep its own negation).
| returns | iFilter | possibly $this's simplified equivalent, or a single member Filter/FilterGroup if it collapsed to one |
test($data, $schema)
Filter.php:422| $data | ArrayAccess | array | |
| $schema = null | null | Schema | |
| returns | bool | see GroupOperator::test for how the members combine (AND/OR/NOR) |
toArray()
Filter.php:449| returns | array | MongoDB-style, e.g. ['$or' => [['name' => 'Marc'], ['name' => 'Bob']]] |
toClosure($data, $schema)
Filter.php:413| $data | ArrayAccess | array | |
| $schema = null | null | Schema | |
| returns | Closure | a zero-arg closure that calls test($data, $schema) when invoked |
__clone()
Filter.php:339| returns | void |
__construct($operator, $args)
Filter.php:334| $operator | GroupOperator | string | |
| ...$args | iFilter | array |
__toString()
Filter.php:458| returns | string | e.g. '((name = "Marc") | (name = "Bob"))', or '!(...)' for a NOR group |