Creates a new compiled evaluator from the supplied expressions.
public static fromExpressions ( array $expressions, Pinq\Expressions\IEvaluationContext $context = null ) : |
||
$expressions | array | |
$context | Pinq\Expressions\IEvaluationContext | |
Результат |
/** * Creates an expression evaluator for the expression with * the supplied context. * * @param IEvaluationContext|null $context * * @return IEvaluator */ public function asEvaluator(IEvaluationContext $context = null) { return CompiledEvaluator::fromExpressions([Expression::returnExpression($this)], $context); }
public function testWithSpecialVariableNames() { $this->assertSame('1,2,3', O\CompiledEvaluator::fromExpressions([O\Expression::returnExpression(O\Expression::variable(O\Expression::value('a special var--')))], O\EvaluationContext::globalScope(null, ['a special var--' => '1,2,3']))->evaluate()); }