TokenParserInterface.php 966 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /*
  3. * This file is part of Twig.
  4. *
  5. * (c) 2010 Fabien Potencier
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. /**
  11. * Interface implemented by token parsers.
  12. *
  13. * @author Fabien Potencier <fabien@symfony.com>
  14. */
  15. interface Twig_TokenParserInterface
  16. {
  17. /**
  18. * Sets the parser associated with this token parser.
  19. *
  20. * @param Twig_Parser $parser A Twig_Parser instance
  21. */
  22. public function setParser(Twig_Parser $parser);
  23. /**
  24. * Parses a token and returns a node.
  25. *
  26. * @param Twig_Token $token A Twig_Token instance
  27. *
  28. * @return Twig_NodeInterface A Twig_NodeInterface instance
  29. *
  30. * @throws Twig_Error_Syntax
  31. */
  32. public function parse(Twig_Token $token);
  33. /**
  34. * Gets the tag name associated with this token parser.
  35. *
  36. * @return string The tag name
  37. */
  38. public function getTag();
  39. }