Oihana PHP Arango

resolveQuantifier.php

Table of Contents

Functions

resolveQuantifier()  : string
Resolve the `quant` parameter into its AQL quantifier keyword.

Functions

resolveQuantifier()

Resolve the `quant` parameter into its AQL quantifier keyword.

resolveQuantifier(mixed $value) : string

The quant value answers the element axis of an array filter — « how many elements must satisfy the condition » — independently of the comparator (which lives in op). Three forms are accepted:

  • a named quantifier any / all / noneANY / ALL / NONE (resolved through FilterQuantifier::getAlias());
  • a bare integer n (or its numeric string, e.g. 3 / "3") → AT LEAST (n). The threshold is cast to an int and inlined, which is injection-safe.

The returned keyword drives both array surfaces uniformly:

  • scalar arrays via the array comparison operator (doc.scores ALL >= @v);
  • object arrays via the question-mark operator (doc.reviews[? ALL FILTER …]).
Parameters
$value : mixed

The raw quant parameter (any/all/none or an integer).

Tags
example
use function oihana\arango\db\helpers\resolveQuantifier;

resolveQuantifier( 'all' ) ; // 'ALL'
resolveQuantifier( 'none' ); // 'NONE'
resolveQuantifier( 3 )     ; // 'AT LEAST (3)'
resolveQuantifier( '3' )   ; // 'AT LEAST (3)'
throws
ValidationException

When the quantifier is neither a known name nor an integer.

since
1.0.0
author

Marc Alcaraz

Return values
string

The AQL quantifier keyword (ANY, ALL, NONE, AT LEAST (n)).

On this page

Search results