protected function Twig_Node_Expression_Call::compileCallable in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/twig/twig/lib/Twig/Node/Expression/Call.php \Twig_Node_Expression_Call::compileCallable()
3 calls to Twig_Node_Expression_Call::compileCallable()
- Twig_Node_Expression_Filter::compile in vendor/
twig/ twig/ lib/ Twig/ Node/ Expression/ Filter.php - Compiles the node to PHP.
- Twig_Node_Expression_Function::compile in vendor/
twig/ twig/ lib/ Twig/ Node/ Expression/ Function.php - Compiles the node to PHP.
- Twig_Node_Expression_Test::compile in vendor/
twig/ twig/ lib/ Twig/ Node/ Expression/ Test.php - Compiles the node to PHP.
File
- vendor/
twig/ twig/ lib/ Twig/ Node/ Expression/ Call.php, line 13
Class
Code
protected function compileCallable(Twig_Compiler $compiler) {
$closingParenthesis = false;
if ($this
->hasAttribute('callable') && ($callable = $this
->getAttribute('callable'))) {
if (is_string($callable)) {
$compiler
->raw($callable);
}
elseif (is_array($callable) && $callable[0] instanceof Twig_ExtensionInterface) {
$compiler
->raw(sprintf('$this->env->getExtension(\'%s\')->%s', $callable[0]
->getName(), $callable[1]));
}
else {
$type = ucfirst($this
->getAttribute('type'));
$compiler
->raw(sprintf('call_user_func_array($this->env->get%s(\'%s\')->getCallable(), array', $type, $this
->getAttribute('name')));
$closingParenthesis = true;
}
}
else {
$compiler
->raw($this
->getAttribute('thing')
->compile());
}
$this
->compileArguments($compiler);
if ($closingParenthesis) {
$compiler
->raw(')');
}
}