ExtensionInterface.php 2.2 KB

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