ExpressionLanguage
    
            
            in package
            
        
    
    
    
        
            Allows to compile and evaluate expressions written in your own DSL.
Tags
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
$functions
    protected
        mixed
    $functions
     = []
        
        
    
$cache
    private
        mixed
    $cache
    
        
        
    
$compiler
    private
        mixed
    $compiler
    
        
        
    
$lexer
    private
        mixed
    $lexer
    
        
        
    
$parser
    private
        mixed
    $parser
    
        
        
    
Methods
__construct()
    public
                __construct([CacheItemPoolInterface|null $cache = null ][, array<string|int, ExpressionFunctionProviderInterface> $providers = [] ]) : mixed
    
        Parameters
- $cache : CacheItemPoolInterface|null = null
 - $providers : array<string|int, ExpressionFunctionProviderInterface> = []
 
Return values
mixed —addFunction()
    public
                addFunction(ExpressionFunction $function) : mixed
        
        Parameters
- $function : ExpressionFunction
 
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
Return values
void —parse()
Parses an expression.
    public
                parse(Expression|string $expression, array<string|int, mixed> $names) : ParsedExpression
    
        Parameters
- $expression : Expression|string
 - 
                    
The expression to parse
 - $names : array<string|int, mixed>
 
Return values
ParsedExpression —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
Return values
mixed —registerProvider()
    public
                registerProvider(ExpressionFunctionProviderInterface $provider) : mixed
        
        Parameters
- $provider : ExpressionFunctionProviderInterface
 
Return values
mixed —registerFunctions()
    protected
                registerFunctions() : mixed
        
    
    
        Return values
mixed —getCompiler()
    private
                getCompiler() : Compiler
        
    
    
        Return values
Compiler —getLexer()
    private
                getLexer() : Lexer
        
    
    
        Return values
Lexer —getParser()
    private
                getParser() : Parser