LoaderInterface.php 1.3 KB

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