protected function Twig_ExpressionParser::getFunctionNodeClass in Translation template extractor 6.3
Same name and namespace in other branches
- 7.3 vendor/Twig/ExpressionParser.php \Twig_ExpressionParser::getFunctionNodeClass()
1 call to Twig_ExpressionParser::getFunctionNodeClass()
- Twig_ExpressionParser::getFunctionNode in vendor/
Twig/ ExpressionParser.php
File
- vendor/
Twig/ ExpressionParser.php, line 543
Class
- Twig_ExpressionParser
- Parses expressions.
Code
protected function getFunctionNodeClass($name, $line) {
$env = $this->parser
->getEnvironment();
if (false === ($function = $env
->getFunction($name))) {
$message = sprintf('The function "%s" does not exist', $name);
if ($alternatives = $env
->computeAlternatives($name, array_keys($env
->getFunctions()))) {
$message = sprintf('%s. Did you mean "%s"', $message, implode('", "', $alternatives));
}
throw new Twig_Error_Syntax($message, $line, $this->parser
->getFilename());
}
if ($function instanceof Twig_SimpleFunction) {
return $function
->getNodeClass();
}
return $function instanceof Twig_Function_Node ? $function
->getClass() : 'Twig_Node_Expression_Function';
}