TokenParserBrokerInterface.php 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /*
  3. * This file is part of Twig.
  4. *
  5. * (c) 2010 Fabien Potencier
  6. * (c) 2010 Arnaud Le Blanc
  7. *
  8. * For the full copyright and license information, please view the LICENSE
  9. * file that was distributed with this source code.
  10. */
  11. /**
  12. * Interface implemented by token parser brokers.
  13. *
  14. * Token parser brokers allows to implement custom logic in the process of resolving a token parser for a given tag name.
  15. *
  16. * @package twig
  17. * @author Arnaud Le Blanc <arnaud.lb@gmail.com>
  18. */
  19. interface Twig_TokenParserBrokerInterface
  20. {
  21. /**
  22. * Gets a TokenParser suitable for a tag.
  23. *
  24. * @param string $tag A tag name
  25. *
  26. * @return null|Twig_TokenParserInterface A Twig_TokenParserInterface or null if no suitable TokenParser was found
  27. */
  28. function getTokenParser($tag);
  29. /**
  30. * Calls Twig_TokenParserInterface::setParser on all parsers the implementation knows of.
  31. *
  32. * @param Twig_ParserInterface $parser A Twig_ParserInterface interface
  33. */
  34. function setParser(Twig_ParserInterface $parser);
  35. /**
  36. * Gets the Twig_ParserInterface.
  37. *
  38. * @return null|Twig_ParserInterface A Twig_ParserInterface instance of null
  39. */
  40. function getParser();
  41. }