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;
15
16/**
17 * Interface all loaders must implement.
18 *
19 * @author Fabien Potencier <fabien@symfony.com>
20 */
21interface LoaderInterface
22{
23    /**
24     * Gets the source code of a template, given its name.
25     *
26     * @param string $name The name of the template to load
27     *
28     * @return string The template source code
29     *
30     * @throws LoaderError When $name is not found
31     *
32     * @deprecated since 1.27 (to be removed in 2.0), implement Twig\Loader\SourceContextLoaderInterface
33     */
34    public function getSource($name);
35
36    /**
37     * Gets the cache key to use for the cache for a given template name.
38     *
39     * @param string $name The name of the template to load
40     *
41     * @return string The cache key
42     *
43     * @throws LoaderError When $name is not found
44     */
45    public function getCacheKey($name);
46
47    /**
48     * Returns true if the template is still fresh.
49     *
50     * @param string $name The template name
51     * @param int    $time Timestamp of the last modification time of the
52     *                     cached template
53     *
54     * @return bool true if the template is fresh, false otherwise
55     *
56     * @throws LoaderError When $name is not found
57     */
58    public function isFresh($name, $time);
59}
60
61class_alias('Twig\Loader\LoaderInterface', 'Twig_LoaderInterface');
62