1<?php 2 3/* 4 * This file is part of Twig. 5 * 6 * (c) Fabien Potencier 7 * 8 * For the full copyright and license information, please view the LICENSE 9 * file that was distributed with this source code. 10 */ 11 12namespace Twig\Loader; 13 14use Twig\Error\LoaderError; 15use Twig\Source; 16 17/** 18 * Interface all loaders must implement. 19 * 20 * @author Fabien Potencier <fabien@symfony.com> 21 */ 22interface LoaderInterface 23{ 24 /** 25 * Returns the source context for a given template logical name. 26 * 27 * @param string $name The template logical name 28 * 29 * @return Source 30 * 31 * @throws LoaderError When $name is not found 32 */ 33 public function getSourceContext($name); 34 35 /** 36 * Gets the cache key to use for the cache for a given template name. 37 * 38 * @param string $name The name of the template to load 39 * 40 * @return string The cache key 41 * 42 * @throws LoaderError When $name is not found 43 */ 44 public function getCacheKey($name); 45 46 /** 47 * Returns true if the template is still fresh. 48 * 49 * @param string $name The template name 50 * @param int $time Timestamp of the last modification time of the 51 * cached template 52 * 53 * @return bool true if the template is fresh, false otherwise 54 * 55 * @throws LoaderError When $name is not found 56 */ 57 public function isFresh($name, $time); 58 59 /** 60 * Check if we have the source code of a template, given its name. 61 * 62 * @param string $name The name of the template to check if we can load 63 * 64 * @return bool If the template source code is handled by this loader or not 65 */ 66 public function exists($name); 67} 68 69class_alias('Twig\Loader\LoaderInterface', 'Twig_LoaderInterface'); 70