Documentation

CompilerRuntime
in package

Compiles JMESPath expressions to PHP source code and executes it.

JMESPath file names are stored in the cache directory using the following logic to determine the filename:

  1. Start with the string "jmespath_"
  2. Append the MD5 checksum of the expression.
  3. Append ".php"

Table of Contents

$cacheDir  : mixed
$compiler  : mixed
$interpreter  : mixed
$parser  : mixed
__construct()  : mixed
__invoke()  : mixed
Returns data from the provided input that matches a given JMESPath expression.
compile()  : mixed

Properties

Methods

__construct()

public __construct([string|null $dir = null ][, Parser|null $parser = null ]) : mixed
Parameters
$dir : string|null = null

Directory used to store compiled PHP files.

$parser : Parser|null = null

JMESPath parser to utilize

Tags
throws
RuntimeException

if the cache directory cannot be created

Return values
mixed

__invoke()

Returns data from the provided input that matches a given JMESPath expression.

public __invoke(string $expression, mixed $data) : mixed
Parameters
$expression : string

JMESPath expression to evaluate

$data : mixed

Data to search. This data should be data that is similar to data returned from json_decode using associative arrays rather than objects.

Tags
throws
RuntimeException
Return values
mixed

Returns the matching data or null

compile()

private compile(mixed $filename, mixed $expression, mixed $functionName) : mixed
Parameters
$filename : mixed
$expression : mixed
$functionName : mixed
Return values
mixed

Search results