\JmesPathFnDispatcher

Dispatches to named JMESPath functions using a single function that has the following signature:

mixed $result = fn(string $function_name, array $args)

Summary

Methods
Properties
Constants
getInstance()
__invoke()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
fn_abs()
fn_avg()
fn_ceil()
fn_contains()
fn_ends_with()
fn_floor()
fn_not_null()
fn_join()
fn_keys()
fn_length()
fn_max()
fn_max_by()
fn_min()
fn_min_by()
fn_reverse()
fn_sum()
fn_sort()
fn_sort_by()
fn_starts_with()
fn_type()
fn_to_string()
fn_to_number()
fn_values()
fn_merge()
fn_to_array()
fn_map()
typeError()
validateArity()
validate()
validateType()
validateSeq()
reduce()
wrapExpression()
No private properties found
N/A

Methods

getInstance()

getInstance() : \JmesPath\FnDispatcher

Gets a cached instance of the default function implementations.

Returns

\JmesPath\FnDispatcher —

__invoke()

__invoke(string  $fn, array  $args) : mixed

Parameters

string $fn

Function name.

array $args

Function arguments.

Returns

mixed —

fn_abs()

fn_abs(array  $args) : mixed

Parameters

array $args

Returns

mixed —

fn_avg()

fn_avg(array  $args) : mixed

Parameters

array $args

Returns

mixed —

fn_ceil()

fn_ceil(array  $args) : mixed

Parameters

array $args

Returns

mixed —

fn_contains()

fn_contains(array  $args) : mixed

Parameters

array $args

Returns

mixed —

fn_ends_with()

fn_ends_with(array  $args) : mixed

Parameters

array $args

Returns

mixed —

fn_floor()

fn_floor(array  $args) : mixed

Parameters

array $args

Returns

mixed —

fn_not_null()

fn_not_null(array  $args) : mixed

Parameters

array $args

Returns

mixed —

fn_join()

fn_join(array  $args) : mixed

Parameters

array $args

Returns

mixed —

fn_keys()

fn_keys(array  $args) : mixed

Parameters

array $args

Returns

mixed —

fn_length()

fn_length(array  $args) : mixed

Parameters

array $args

Returns

mixed —

fn_max()

fn_max(array  $args) : mixed

Parameters

array $args

Returns

mixed —

fn_max_by()

fn_max_by(array  $args) : mixed

Parameters

array $args

Returns

mixed —

fn_min()

fn_min(array  $args) : mixed

Parameters

array $args

Returns

mixed —

fn_min_by()

fn_min_by(array  $args) : mixed

Parameters

array $args

Returns

mixed —

fn_reverse()

fn_reverse(array  $args) : mixed

Parameters

array $args

Returns

mixed —

fn_sum()

fn_sum(array  $args) : mixed

Parameters

array $args

Returns

mixed —

fn_sort()

fn_sort(array  $args) : mixed

Parameters

array $args

Returns

mixed —

fn_sort_by()

fn_sort_by(array  $args) : mixed

Parameters

array $args

Returns

mixed —

fn_starts_with()

fn_starts_with(array  $args) : mixed

Parameters

array $args

Returns

mixed —

fn_type()

fn_type(array  $args) : mixed

Parameters

array $args

Returns

mixed —

fn_to_string()

fn_to_string(array  $args) : mixed

Parameters

array $args

Returns

mixed —

fn_to_number()

fn_to_number(array  $args) : mixed

Parameters

array $args

Returns

mixed —

fn_values()

fn_values(array  $args) : mixed

Parameters

array $args

Returns

mixed —

fn_merge()

fn_merge(array  $args) : mixed

Parameters

array $args

Returns

mixed —

fn_to_array()

fn_to_array(array  $args) : mixed

Parameters

array $args

Returns

mixed —

fn_map()

fn_map(array  $args) : mixed

Parameters

array $args

Returns

mixed —

typeError()

typeError(mixed  $from, mixed  $msg) : mixed

Parameters

mixed $from
mixed $msg

Returns

mixed —

validateArity()

validateArity(mixed  $from, mixed  $given, mixed  $expected) : mixed

Parameters

mixed $from
mixed $given
mixed $expected

Returns

mixed —

validate()

validate(mixed  $from, mixed  $args, mixed  $types = []) : mixed

Parameters

mixed $from
mixed $args
mixed $types

Returns

mixed —

validateType()

validateType(mixed  $from, mixed  $value, array  $types) : mixed

Parameters

mixed $from
mixed $value
array $types

Returns

mixed —

validateSeq()

validateSeq(string  $from, array  $types, mixed  $a, mixed  $b) : mixed

Validates value A and B, ensures they both are correctly typed, and of the same type.

Parameters

string $from

String of function:argument_position

array $types

Array of valid value types.

mixed $a

Value A

mixed $b

Value B

Returns

mixed —

reduce()

reduce(string  $from, array  $values, array  $types, callable  $reduce) : mixed

Reduces and validates an array of values to a single value using a fn.

Parameters

string $from

String of function:argument_position

array $values

Values to reduce.

array $types

Array of valid value types.

callable $reduce

Reduce function that accepts ($carry, $item).

Returns

mixed —

wrapExpression()

wrapExpression(string  $from, callable  $expr, array  $types) : callable

Validates the return values of expressions as they are applied.

Parameters

string $from

Function name : position

callable $expr

Expression function to validate.

array $types

Array of acceptable return type values.

Returns

callable —

Returns a wrapped function