Skip to content

Commit 87fc813

Browse files
committed
[ExpressionLanguage] Store compiler and evaluator as closures
Signed-off-by: Alexander M. Turek <[email protected]>
1 parent 4d4b394 commit 87fc813

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

ExpressionFunction.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,29 @@ class ExpressionFunction
4242
public function __construct(string $name, callable $compiler, callable $evaluator)
4343
{
4444
$this->name = $name;
45-
$this->compiler = $compiler;
46-
$this->evaluator = $evaluator;
45+
$this->compiler = $compiler instanceof \Closure ? $compiler : \Closure::fromCallable($compiler);
46+
$this->evaluator = $evaluator instanceof \Closure ? $evaluator : \Closure::fromCallable($evaluator);
4747
}
4848

49+
/**
50+
* @return string
51+
*/
4952
public function getName()
5053
{
5154
return $this->name;
5255
}
5356

57+
/**
58+
* @return \Closure
59+
*/
5460
public function getCompiler()
5561
{
5662
return $this->compiler;
5763
}
5864

65+
/**
66+
* @return \Closure
67+
*/
5968
public function getEvaluator()
6069
{
6170
return $this->evaluator;

0 commit comments

Comments
 (0)