Gets the registered Token Parsers.
Twig_TokenParserBrokerInterface A broker containing token parsers
public function getTokenParsers() {
if (null === $this->parsers) {
$this->parsers = new Twig_TokenParserBroker();
if (isset($this->staging['token_parsers'])) {
foreach ($this->staging['token_parsers'] as $parser) {
$this->parsers
->addTokenParser($parser);
}
}
foreach ($this
->getExtensions() as $extension) {
$parsers = $extension
->getTokenParsers();
foreach ($parsers as $parser) {
if ($parser instanceof Twig_TokenParserInterface) {
$this->parsers
->addTokenParser($parser);
}
elseif ($parser instanceof Twig_TokenParserBrokerInterface) {
$this->parsers
->addTokenParserBroker($parser);
}
else {
throw new Twig_Error_Runtime('getTokenParsers() must return an array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances');
}
}
}
}
return $this->parsers;
}