public function Twig_TokenParserBroker::__construct in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/twig/twig/lib/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:
bool $triggerDeprecationError:
File
- vendor/
twig/ twig/ lib/ Twig/ TokenParserBroker.php, line 33
Class
- Twig_TokenParserBroker
- Default implementation of a token parser broker.
Code
public function __construct($parsers = array(), $brokers = array(), $triggerDeprecationError = true) {
if ($triggerDeprecationError) {
@trigger_error('The ' . __CLASS__ . ' class is deprecated since version 1.12 and will be removed in 2.0.', E_USER_DEPRECATED);
}
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;
}
}