Oihana PHP Arango

isFilterSegment.php

Table of Contents

Functions

isFilterSegment()  : bool
Tells whether an array is a filter — a segment or a logical group — rather than a model init that merely carries no filter.

Functions

isFilterSegment()

Tells whether an array is a filter — a segment or a logical group — rather than a model init that merely carries no filter.

isFilterSegment(array<string|int, mixed> $value) : bool

prepareFilter() receives both : the whole $init of a list() call, where Arango::FILTER may be absent, and the filter payload itself, at the root or as a child of an and / or group. An init without a filter is no fault — it is the ordinary unfiltered list. A segment that says val or op but names no key is one, and so is any filter on a model that declares no filterable key at all. The two read alike (an associative array without key), and this is what tells them apart : a filter is a list (a logical group), or it names a key, or it speaks the filter grammar — a value, an operator, a match, a quantifier, a function, a bound.

Parameters
$value : array<string|int, mixed>

The array to qualify.

Tags
example
isFilterSegment( [ 'key' => 'name' , 'val' => 'x' ] ) ; // true
isFilterSegment( [ 'val' => 'x' ] ) ;                   // true  — a segment that names no key
isFilterSegment( [ 'and' , [ … ] , [ … ] ] ) ;          // true  — a logical group
isFilterSegment( [ 'limit' => 10 ] ) ;                  // false — an init without a filter
author

Marc Alcaraz (ekameleon)

Return values
bool —

true for a filter segment or group, false for anything else.

On this page

Search results