class Utility (View source)

Utility to reduce boilerplate code needed to set default context variables and evaluate a string that possibly is an EEL expression.

Methods

static string|null
parseEelExpression(string $expression)

Return the expression if it is a valid EEL expression, null otherwise.

static array
getDefaultContextVariables(array $configuration)

Get variables from configuration that should be set in the context by default.

static mixed
evaluateEelExpression(string $expression, EelEvaluatorInterface $eelEvaluator, array $contextVariables, array $defaultContextConfiguration = [])

Evaluate an Eel expression.

Details

static string|null parseEelExpression(string $expression)

Return the expression if it is a valid EEL expression, null otherwise.

Parameters

string $expression

Return Value

string|null

static array getDefaultContextVariables(array $configuration)

Get variables from configuration that should be set in the context by default.

For example Eel helpers are made available by this.

Parameters

array $configuration

An one dimensional associative array of context variable paths mapping to object names

Return Value

array

Array with default context variable objects.

static mixed evaluateEelExpression(string $expression, EelEvaluatorInterface $eelEvaluator, array $contextVariables, array $defaultContextConfiguration = [])

Evaluate an Eel expression.

Parameters

string $expression
EelEvaluatorInterface $eelEvaluator
array $contextVariables
array $defaultContextConfiguration

Return Value

mixed

Exceptions

Exception