blob: fec7e85ff7cb2b5c13c7685cc13f9efdb1c66a8e [file] [log] [blame]
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +01001<?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 * @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}