protected function Twig_ExpressionParser::getFilterNodeClass in Translation template extractor 6.3
Same name and namespace in other branches
- 7.3 vendor/Twig/ExpressionParser.php \Twig_ExpressionParser::getFilterNodeClass()
2 calls to Twig_ExpressionParser::getFilterNodeClass()
File
- vendor/
Twig/ ExpressionParser.php, line 563
Class
- Twig_ExpressionParser
- Parses expressions.
Code
protected function getFilterNodeClass($name, $line) {
$env = $this->parser
->getEnvironment();
if (false === ($filter = $env
->getFilter($name))) {
$message = sprintf('The filter "%s" does not exist', $name);
if ($alternatives = $env
->computeAlternatives($name, array_keys($env
->getFilters()))) {
$message = sprintf('%s. Did you mean "%s"', $message, implode('", "', $alternatives));
}
throw new Twig_Error_Syntax($message, $line, $this->parser
->getFilename());
}
if ($filter instanceof Twig_SimpleFilter) {
return $filter
->getNodeClass();
}
return $filter instanceof Twig_Filter_Node ? $filter
->getClass() : 'Twig_Node_Expression_Filter';
}