CompilingEvaluator
class CompilingEvaluator implements EelEvaluatorInterface (View source)
An evaluator that compiles expressions down to PHP code
This simple implementation will lazily parse and evaluate the generated PHP code into a function with a name built from the hashed expression.
Properties
protected closure[] | $evaluatedExpressions | Runtime cache of execution ready closures. |
|
protected StringFrontend | $expressionCache |
Methods
injectExpressionCache(StringFrontend $expressionCache)
TODO: As soon as we support PSR-16 (Simple Cache) this could be replaced by a simple cache.
mixed
string
generateEvaluatorCode(string $expression)
Internal generator method
Details
injectExpressionCache(StringFrontend $expressionCache)
TODO: As soon as we support PSR-16 (Simple Cache) this could be replaced by a simple cache.
mixed
evaluate(string $expression, Context $context)
Evaluate an expression under a given context
protected string
generateEvaluatorCode(string $expression)
Internal generator method
Used by unit tests to debug generated PHP code.