TemplateInterface.php 1.2KB

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. * Interface implemented by all compiled templates.
  12. *
  13. * @package twig
  14. * @author Fabien Potencier <fabien@symfony.com>
  15. */
  16. interface Twig_TemplateInterface
  17. {
  18. const ANY_CALL = 'any';
  19. const ARRAY_CALL = 'array';
  20. const METHOD_CALL = 'method';
  21. /**
  22. * Renders the template with the given context and returns it as string.
  23. *
  24. * @param array $context An array of parameters to pass to the template
  25. *
  26. * @return string The rendered template
  27. */
  28. function render(array $context);
  29. /**
  30. * Displays the template with the given context.
  31. *
  32. * @param array $context An array of parameters to pass to the template
  33. * @param array $blocks An array of blocks to pass to the template
  34. */
  35. function display(array $context, array $blocks = array());
  36. /**
  37. * Returns the bound environment for this template.
  38. *
  39. * @return Twig_Environment The current environment
  40. */
  41. function getEnvironment();
  42. }