Twig API
Class

Twig_TokenParserBroker

class Twig_TokenParserBroker implements Twig_TokenParserBrokerInterface

Default implementation of a token parser broker.

Methods

__construct(array|Traversable $parsers = array(), array|Traversable $brokers = array())

Constructor.

addTokenParser(Twig_TokenParserInterface $parser)

Adds a TokenParser.

removeTokenParser(Twig_TokenParserInterface $parser)

Removes a TokenParser.

addTokenParserBroker(Twig_TokenParserBroker $broker)

Adds a TokenParserBroker.

removeTokenParserBroker(Twig_TokenParserBroker $broker)

Removes a TokenParserBroker.

null|Twig_TokenParserInterface getTokenParser(string $tag)

Gets a suitable TokenParser for a tag.

getParsers()

null|Twig_ParserInterface getParser()

Gets the Twig_ParserInterface.

setParser(Twig_ParserInterface $parser)

Calls Twig_TokenParserInterface::setParser on all parsers the implementation knows of.

Details

at line 31
public __construct(array|Traversable $parsers = array(), array|Traversable $brokers = array())

Constructor.

Parameters

array|Traversable $parsers A Traversable of Twig_TokenParserInterface instances
array|Traversable $brokers A Traversable of Twig_TokenParserBrokerInterface instances

at line 52
public addTokenParser(Twig_TokenParserInterface $parser)

Adds a TokenParser.

Parameters

Twig_TokenParserInterface $parser A Twig_TokenParserInterface instance

at line 62
public removeTokenParser(Twig_TokenParserInterface $parser)

Removes a TokenParser.

Parameters

Twig_TokenParserInterface $parser A Twig_TokenParserInterface instance

at line 75
public addTokenParserBroker(Twig_TokenParserBroker $broker)

Adds a TokenParserBroker.

Parameters

Twig_TokenParserBroker $broker A Twig_TokenParserBroker instance

at line 85
public removeTokenParserBroker(Twig_TokenParserBroker $broker)

Removes a TokenParserBroker.

Parameters

Twig_TokenParserBroker $broker A Twig_TokenParserBroker instance

at line 101
public null|Twig_TokenParserInterface getTokenParser(string $tag)

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

at line 118
public getParsers()

at line 123
public null|Twig_ParserInterface getParser()

Gets the Twig_ParserInterface.

Return Value

null|Twig_ParserInterface A Twig_ParserInterface instance or null

at line 128
public setParser(Twig_ParserInterface $parser)

Calls Twig_TokenParserInterface::setParser on all parsers the implementation knows of.

Parameters

Twig_ParserInterface $parser A Twig_ParserInterface interface