33 if ($triggerDeprecationError) {
34 @trigger_error(
'The '.__CLASS__.
' class is deprecated since version 1.12 and will be removed in 2.0.', E_USER_DEPRECATED);
39 throw new LogicException(
'$parsers must a an array of Twig_TokenParserInterface.');
41 $this->parsers[$parser->getTag()] =
$parser;
45 throw new LogicException(
'$brokers must a an array of Twig_TokenParserBrokerInterface.');
47 $this->brokers[] = $broker;
59 if (isset($this->parsers[
$name]) && $parser === $this->parsers[$name]) {
60 unset($this->parsers[$name]);
66 $this->brokers[] = $broker;
71 if (
false !== $pos = array_search($broker, $this->brokers)) {
72 unset($this->brokers[$pos]);
87 if (isset($this->parsers[
$tag])) {
88 return $this->parsers[
$tag];
90 $broker = end($this->brokers);
91 while (
false !== $broker) {
92 $parser = $broker->getTokenParser($tag);
96 $broker = prev($this->brokers);
113 foreach ($this->parsers as $tokenParser) {
114 $tokenParser->setParser($parser);
116 foreach ($this->brokers as $broker) {
117 $broker->setParser($parser);
getTag()
Gets the tag name associated with this token parser.
removeTokenParser(Twig_TokenParserInterface $parser)
Interface implemented by token parser brokers.
Interface implemented by parser classes.
getTokenParser($tag)
Gets a suitable TokenParser for a tag.
__construct($parsers=array(), $brokers=array(), $triggerDeprecationError=true)
removeTokenParserBroker(self $broker)
addTokenParserBroker(self $broker)
getParser()
Gets the Twig_ParserInterface.
Create styles array
The data for the language used.
Interface implemented by token parsers.
Default implementation of a token parser broker.
addTokenParser(Twig_TokenParserInterface $parser)
if(function_exists('posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
setParser(Twig_ParserInterface $parser)
Calls Twig_TokenParserInterface::setParser on all parsers the implementation knows of...