public function Twig_TokenParserBroker::__construct in Translation template extractor 6.3
Same name and namespace in other branches
- 7.3 vendor/Twig/TokenParserBroker.php \Twig_TokenParserBroker::__construct()
Constructor.
Parameters
array|Traversable $parsers A Traversable of Twig_TokenParserInterface instances:
array|Traversable $brokers A Traversable of Twig_TokenParserBrokerInterface instances:
File
- vendor/
Twig/ TokenParserBroker.php, line 31
Class
- Twig_TokenParserBroker
- Default implementation of a token parser broker.
Code
public function __construct($parsers = array(), $brokers = array()) {
foreach ($parsers as $parser) {
if (!$parser instanceof Twig_TokenParserInterface) {
throw new LogicException('$parsers must a an array of Twig_TokenParserInterface');
}
$this->parsers[$parser
->getTag()] = $parser;
}
foreach ($brokers as $broker) {
if (!$broker instanceof Twig_TokenParserBrokerInterface) {
throw new LogicException('$brokers must a an array of Twig_TokenParserBrokerInterface');
}
$this->brokers[] = $broker;
}
}