class ExpressionLanguage extends ExpressionLanguage

Adds some function to the default ExpressionLanguage.

Properties

protected $functions from ExpressionLanguage

Methods

__construct(CacheItemPoolInterface $cache = null, array $providers = [], callable $serviceCompiler = null)

No description

string
compile(Expression|string $expression, array $names = [])

Compiles an expression source code.

mixed
evaluate(Expression|string $expression, array $values = [])

Evaluate an expression.

parse(Expression|string $expression, array $names)

Parses an expression.

register(string $name, callable $compiler, callable $evaluator)

Registers a function.

addFunction(ExpressionFunction $function)

No description

registerFunctions()

No description

Details

at line 28
__construct(CacheItemPoolInterface $cache = null, array $providers = [], callable $serviceCompiler = null)

Parameters

CacheItemPoolInterface $cache
array $providers
callable $serviceCompiler

in ExpressionLanguage at line 63
string compile(Expression|string $expression, array $names = [])

Compiles an expression source code.

Parameters

Expression|string $expression The expression to compile
array $names An array of valid names

Return Value

string The compiled PHP source code

in ExpressionLanguage at line 76
mixed evaluate(Expression|string $expression, array $values = [])

Evaluate an expression.

Parameters

Expression|string $expression The expression to compile
array $values An array of values

Return Value

mixed The result of the evaluation of the expression

in ExpressionLanguage at line 89
ParsedExpression parse(Expression|string $expression, array $names)

Parses an expression.

Parameters

Expression|string $expression The expression to parse
array $names An array of valid names

Return Value

ParsedExpression A ParsedExpression instance

in ExpressionLanguage at line 126
register(string $name, callable $compiler, callable $evaluator)

Registers a function.

Parameters

string $name The function name
callable $compiler A callable able to compile the function
callable $evaluator A callable able to evaluate the function

Exceptions

LogicException when registering a function after calling evaluate(), compile() or parse()

See also

ExpressionFunction

in ExpressionLanguage at line 135
addFunction(ExpressionFunction $function)

Parameters

ExpressionFunction $function

in ExpressionLanguage at line 140
registerProvider(ExpressionFunctionProviderInterface $provider)

in ExpressionLanguage at line 147
protected registerFunctions()