ExpressionFunction
in package
Represents a function that can be used in an expression.
A function is defined by two PHP callables. The callables are used by the language to compile and/or evaluate the function.
The "compiler" function is used at compilation time and must return a PHP representation of the function call (it receives the function arguments as arguments).
The "evaluator" function is used for expression evaluation and must return the value of the function call based on the values defined for the expression (it receives the values as a first argument and the function arguments as remaining arguments).
Tags
Table of Contents
- $compiler : mixed
- $evaluator : mixed
- $name : mixed
- __construct() : mixed
- fromPhp() : self
- Creates an ExpressionFunction from a PHP function name.
- getCompiler() : mixed
- getEvaluator() : mixed
- getName() : mixed
Properties
$compiler
private
mixed
$compiler
$evaluator
private
mixed
$evaluator
$name
private
mixed
$name
Methods
__construct()
public
__construct(string $name, callable $compiler, callable $evaluator) : mixed
Parameters
- $name : string
-
The function name
- $compiler : callable
-
A callable able to compile the function
- $evaluator : callable
-
A callable able to evaluate the function
Return values
mixed —fromPhp()
Creates an ExpressionFunction from a PHP function name.
public
static fromPhp(string $phpFunctionName[, string|null $expressionFunctionName = null ]) : self
Parameters
- $phpFunctionName : string
-
The PHP function name
- $expressionFunctionName : string|null = null
-
The expression function name (default: same than the PHP function name)
Tags
Return values
self —getCompiler()
public
getCompiler() : mixed
Return values
mixed —getEvaluator()
public
getEvaluator() : mixed
Return values
mixed —getName()
public
getName() : mixed