Version 1
[yaffs-website] / vendor / twig / twig / lib / Twig / Loader / String.php
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 @trigger_error('The Twig_Loader_String class is deprecated since version 1.18.1 and will be removed in 2.0. Use Twig_Loader_Array instead or Twig_Environment::createTemplate().', E_USER_DEPRECATED);
13
14 /**
15  * Loads a template from a string.
16  *
17  * This loader should NEVER be used. It only exists for Twig internal purposes.
18  *
19  * When using this loader with a cache mechanism, you should know that a new cache
20  * key is generated each time a template content "changes" (the cache key being the
21  * source code of the template). If you don't want to see your cache grows out of
22  * control, you need to take care of clearing the old cache file by yourself.
23  *
24  * @deprecated since 1.18.1 (to be removed in 2.0)
25  *
26  * @internal
27  *
28  * @author Fabien Potencier <fabien@symfony.com>
29  */
30 class Twig_Loader_String implements Twig_LoaderInterface, Twig_ExistsLoaderInterface, Twig_SourceContextLoaderInterface
31 {
32     public function getSource($name)
33     {
34         @trigger_error(sprintf('Calling "getSource" on "%s" is deprecated since 1.27. Use getSourceContext() instead.', get_class($this)), E_USER_DEPRECATED);
35
36         return $name;
37     }
38
39     public function getSourceContext($name)
40     {
41         return new Twig_Source($name, $name);
42     }
43
44     public function exists($name)
45     {
46         return true;
47     }
48
49     public function getCacheKey($name)
50     {
51         return $name;
52     }
53
54     public function isFresh($name, $time)
55     {
56         return true;
57     }
58 }