ExtensionInterface.php 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. * Interface implemented by extension classes.
  12. *
  13. * @package twig
  14. * @author Fabien Potencier <fabien@symfony.com>
  15. */
  16. interface Twig_ExtensionInterface
  17. {
  18. /**
  19. * Initializes the runtime environment.
  20. *
  21. * This is where you can load some file that contains filter functions for instance.
  22. *
  23. * @param Twig_Environment $environment The current Twig_Environment instance
  24. */
  25. function initRuntime(Twig_Environment $environment);
  26. /**
  27. * Returns the token parser instances to add to the existing list.
  28. *
  29. * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances
  30. */
  31. function getTokenParsers();
  32. /**
  33. * Returns the node visitor instances to add to the existing list.
  34. *
  35. * @return array An array of Twig_NodeVisitorInterface instances
  36. */
  37. function getNodeVisitors();
  38. /**
  39. * Returns a list of filters to add to the existing list.
  40. *
  41. * @return array An array of filters
  42. */
  43. function getFilters();
  44. /**
  45. * Returns a list of tests to add to the existing list.
  46. *
  47. * @return array An array of tests
  48. */
  49. function getTests();
  50. /**
  51. * Returns a list of functions to add to the existing list.
  52. *
  53. * @return array An array of functions
  54. */
  55. function getFunctions();
  56. /**
  57. * Returns a list of operators to add to the existing list.
  58. *
  59. * @return array An array of operators
  60. */
  61. function getOperators();
  62. /**
  63. * Returns a list of global functions to add to the existing list.
  64. *
  65. * @return array An array of global functions
  66. */
  67. function getGlobals();
  68. /**
  69. * Returns the name of the extension.
  70. *
  71. * @return string The extension name
  72. */
  73. function getName();
  74. }