TreeInterpreter
in package
Tree visitor used to evaluates JMESPath AST expressions.
Table of Contents
- $fnDispatcher : callable
- __construct() : mixed
- visit() : mixed
- Visits each node in a JMESPath AST and returns the evaluated result.
- dispatch() : mixed
- Recursively traverses an AST using depth-first, pre-order traversal.
- relativeCmp() : bool
Properties
$fnDispatcher
private
callable
$fnDispatcher
Methods
__construct()
public
__construct([callable|null $fnDispatcher = null ]) : mixed
Parameters
- $fnDispatcher : callable|null = null
-
Function dispatching function that accepts a function name argument and an array of function arguments and returns the result.
Return values
mixed —visit()
Visits each node in a JMESPath AST and returns the evaluated result.
public
visit(array<string|int, mixed> $node, mixed $data) : mixed
Parameters
- $node : array<string|int, mixed>
-
JMESPath AST node
- $data : mixed
-
Data to evaluate
Return values
mixed —dispatch()
Recursively traverses an AST using depth-first, pre-order traversal.
private
dispatch(array<string|int, mixed> $node, mixed $value) : mixed
The evaluation logic for each node type is embedded into a large switch statement to avoid the cost of "double dispatch".
Parameters
- $node : array<string|int, mixed>
- $value : mixed
Return values
mixed —relativeCmp()
private
static relativeCmp(mixed $left, mixed $right, mixed $cmp) : bool
Parameters
- $left : mixed
- $right : mixed
- $cmp : mixed