private ?\Closure
$getEnv;
public function __construct(callable
$serviceCompiler = null, \Closure
$getEnv = null
) { $this->serviceCompiler = null ===
$serviceCompiler ? null :
$serviceCompiler(...
);
$this->getEnv =
$getEnv;
} public function getFunctions(): array
{ return [ new ExpressionFunction('service',
$this->serviceCompiler ??
fn ($arg) =>
sprintf('$container->get(%s)',
$arg),
fn (array
$variables,
$value) =>
$variables['container'
]->
get($value)),
new ExpressionFunction('parameter',
fn ($arg) =>
sprintf('$container->getParameter(%s)',
$arg),
fn (array
$variables,
$value) =>
$variables['container'
]->
getParameter($value)),
new ExpressionFunction('env',
fn ($arg) =>
sprintf('$container->getEnv(%s)',
$arg),
function Darray
$variables,
$value) { if (!
$this->getEnv
) { throw new LogicException('You need to pass a getEnv closure to the expression langage provider to use the "env" function.'
);
} return ($this->getEnv
)($value);
}),