LoaderInterface.php 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 all loaders must implement.
  12. *
  13. * @package twig
  14. * @author Fabien Potencier <fabien@symfony.com>
  15. */
  16. interface Twig_LoaderInterface
  17. {
  18. /**
  19. * Gets the source code of a template, given its name.
  20. *
  21. * @param string $name The name of the template to load
  22. *
  23. * @return string The template source code
  24. *
  25. * @throws Twig_Error_Loader When $name is not found
  26. */
  27. function getSource($name);
  28. /**
  29. * Gets the cache key to use for the cache for a given template name.
  30. *
  31. * @param string $name The name of the template to load
  32. *
  33. * @return string The cache key
  34. *
  35. * @throws Twig_Error_Loader When $name is not found
  36. */
  37. function getCacheKey($name);
  38. /**
  39. * Returns true if the template is still fresh.
  40. *
  41. * @param string $name The template name
  42. * @param timestamp $time The last modification time of the cached template
  43. *
  44. * @return Boolean true if the template is fresh, false otherwise
  45. *
  46. * @throws Twig_Error_Loader When $name is not found
  47. */
  48. function isFresh($name, $time);
  49. }