public function Twig_TokenParserBroker::getTokenParser in Translation template extractor 6.3
Same name and namespace in other branches
- 7.3 vendor/Twig/TokenParserBroker.php \Twig_TokenParserBroker::getTokenParser()
Gets a suitable TokenParser for a tag.
First looks in parsers, then in brokers.
Parameters
string $tag A tag name:
Return value
null|Twig_TokenParserInterface A Twig_TokenParserInterface or null if no suitable TokenParser was found
Overrides Twig_TokenParserBrokerInterface::getTokenParser
File
- vendor/
Twig/ TokenParserBroker.php, line 101
Class
- Twig_TokenParserBroker
- Default implementation of a token parser broker.
Code
public function getTokenParser($tag) {
if (isset($this->parsers[$tag])) {
return $this->parsers[$tag];
}
$broker = end($this->brokers);
while (false !== $broker) {
$parser = $broker
->getTokenParser($tag);
if (null !== $parser) {
return $parser;
}
$broker = prev($this->brokers);
}
}