NodeVisitorInterface.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /*
  3. * This file is part of Twig.
  4. *
  5. * (c) 2009 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. * Twig_NodeVisitorInterface is the interface the all node visitor classes must implement.
  12. *
  13. * @author Fabien Potencier <fabien@symfony.com>
  14. */
  15. interface Twig_NodeVisitorInterface
  16. {
  17. /**
  18. * Called before child nodes are visited.
  19. *
  20. * @param Twig_NodeInterface $node The node to visit
  21. * @param Twig_Environment $env The Twig environment instance
  22. *
  23. * @return Twig_NodeInterface The modified node
  24. */
  25. public function enterNode(Twig_NodeInterface $node, Twig_Environment $env);
  26. /**
  27. * Called after child nodes are visited.
  28. *
  29. * @param Twig_NodeInterface $node The node to visit
  30. * @param Twig_Environment $env The Twig environment instance
  31. *
  32. * @return Twig_NodeInterface|false The modified node or false if the node must be removed
  33. */
  34. public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env);
  35. /**
  36. * Returns the priority for this visitor.
  37. *
  38. * Priority should be between -10 and 10 (0 is the default).
  39. *
  40. * @return int The priority level
  41. */
  42. public function getPriority();
  43. }