Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame^] | 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 | |
| 12 | namespace Twig\Loader; |
| 13 | |
| 14 | use Twig\Error\LoaderError; |
| 15 | use Twig\Source; |
| 16 | |
| 17 | /** |
| 18 | * Interface all loaders must implement. |
| 19 | * |
| 20 | * @author Fabien Potencier <fabien@symfony.com> |
| 21 | */ |
| 22 | interface LoaderInterface |
| 23 | { |
| 24 | /** |
| 25 | * Returns the source context for a given template logical name. |
| 26 | * |
| 27 | * @throws LoaderError When $name is not found |
| 28 | */ |
| 29 | public function getSourceContext(string $name): Source; |
| 30 | |
| 31 | /** |
| 32 | * Gets the cache key to use for the cache for a given template name. |
| 33 | * |
| 34 | * @throws LoaderError When $name is not found |
| 35 | */ |
| 36 | public function getCacheKey(string $name): string; |
| 37 | |
| 38 | /** |
| 39 | * @param int $time Timestamp of the last modification time of the cached template |
| 40 | * |
| 41 | * @throws LoaderError When $name is not found |
| 42 | */ |
| 43 | public function isFresh(string $name, int $time): bool; |
| 44 | |
| 45 | /** |
| 46 | * @return bool |
| 47 | */ |
| 48 | public function exists(string $name); |
| 49 | } |