Documentation

ExpressionLanguage extends ExpressionLanguage
in package

Adds some function to the default ExpressionLanguage.

Tags
author

Fabien Potencier fabien@symfony.com

see
ExpressionLanguageProvider

Table of Contents

$functions  : mixed
$cache  : mixed
$compiler  : mixed
$lexer  : mixed
$parser  : mixed
__construct()  : mixed
addFunction()  : mixed
compile()  : string
Compiles an expression source code.
evaluate()  : mixed
Evaluate an expression.
lint()  : void
Validates the syntax of an expression.
parse()  : ParsedExpression
Parses an expression.
register()  : mixed
Registers a function.
registerProvider()  : mixed
registerFunctions()  : mixed
getCompiler()  : Compiler
getLexer()  : Lexer
getParser()  : Parser

Properties

Methods

__construct()

public __construct([CacheItemPoolInterface|null $cache = null ][, array<string|int, mixed> $providers = [] ][, callable|null $serviceCompiler = null ]) : mixed
Parameters
$cache : CacheItemPoolInterface|null = null
$providers : array<string|int, mixed> = []
$serviceCompiler : callable|null = null
Return values
mixed

compile()

Compiles an expression source code.

public compile(Expression|string $expression[, array<string|int, mixed> $names = [] ]) : string
Parameters
$expression : Expression|string

The expression to compile

$names : array<string|int, mixed> = []
Return values
string

evaluate()

Evaluate an expression.

public evaluate(Expression|string $expression[, array<string|int, mixed> $values = [] ]) : mixed
Parameters
$expression : Expression|string

The expression to compile

$values : array<string|int, mixed> = []
Return values
mixed

lint()

Validates the syntax of an expression.

public lint(Expression|string $expression, array<string|int, mixed>|null $names) : void
Parameters
$expression : Expression|string

The expression to validate

$names : array<string|int, mixed>|null

The list of acceptable variable names in the expression, or null to accept any names

Tags
throws
SyntaxError

When the passed expression is invalid

Return values
void

register()

Registers a function.

public register(string $name, callable $compiler, callable $evaluator) : mixed
Parameters
$name : string
$compiler : callable

A callable able to compile the function

$evaluator : callable

A callable able to evaluate the function

Tags
throws
LogicException

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

see
ExpressionFunction
Return values
mixed

registerFunctions()

protected registerFunctions() : mixed
Return values
mixed

Search results