ExpressionLanguage

class ExpressionLanguage extends ExpressionLanguage

Adds some function to the default ExpressionLanguage.

Methods

__construct(CacheItemPoolInterface $cache = null, array $providers = array())
string compile(Expression|string $expression, array $names = array())

Compiles an expression source code.

from ExpressionLanguage
string evaluate(Expression|string $expression, array $values = array())

Evaluate an expression.

from ExpressionLanguage
ParsedExpression parse(Expression|string $expression, array $names)

Parses an expression.

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

Registers a function.

from ExpressionLanguage
addFunction(ExpressionFunction $function) from ExpressionLanguage
registerProvider(ExpressionFunctionProviderInterface $provider) from ExpressionLanguage

Details

__construct(CacheItemPoolInterface $cache = null, array $providers = array())

Parameters

CacheItemPoolInterface $cache
array $providers

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

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

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

Evaluate an expression.

Parameters

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

Return Value

string The result of the evaluation of the expression

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

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

addFunction(ExpressionFunction $function)

Parameters

ExpressionFunction $function

registerProvider(ExpressionFunctionProviderInterface $provider)

Parameters

ExpressionFunctionProviderInterface $provider

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/4.0/Symfony/Component/Security/Core/Authorization/ExpressionLanguage.html