diff options
author | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2013-08-02 22:43:56 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2013-08-02 22:43:56 +0200 |
commit | 8069e235fd2971675ee5fc05026ffa9bce5cbbb7 (patch) | |
tree | 872eaed228b5e1b031c21770fba1701106a52a39 /inc/3rdparty/Twig/Loader/String.php | |
parent | 45161a64026cec35fcf07659508143a6f55ddf57 (diff) | |
download | wallabag-8069e235fd2971675ee5fc05026ffa9bce5cbbb7.tar.gz wallabag-8069e235fd2971675ee5fc05026ffa9bce5cbbb7.tar.zst wallabag-8069e235fd2971675ee5fc05026ffa9bce5cbbb7.zip |
move Twig in 3rdparty
Diffstat (limited to 'inc/3rdparty/Twig/Loader/String.php')
-rw-r--r-- | inc/3rdparty/Twig/Loader/String.php | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/inc/3rdparty/Twig/Loader/String.php b/inc/3rdparty/Twig/Loader/String.php new file mode 100644 index 00000000..8ad9856c --- /dev/null +++ b/inc/3rdparty/Twig/Loader/String.php | |||
@@ -0,0 +1,59 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of Twig. | ||
5 | * | ||
6 | * (c) 2009 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 | /** | ||
13 | * Loads a template from a string. | ||
14 | * | ||
15 | * This loader should only be used for unit testing as it has many limitations | ||
16 | * (for instance, the include or extends tag does not make any sense for a string | ||
17 | * loader). | ||
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 | * @author Fabien Potencier <fabien@symfony.com> | ||
25 | */ | ||
26 | class Twig_Loader_String implements Twig_LoaderInterface, Twig_ExistsLoaderInterface | ||
27 | { | ||
28 | /** | ||
29 | * {@inheritdoc} | ||
30 | */ | ||
31 | public function getSource($name) | ||
32 | { | ||
33 | return $name; | ||
34 | } | ||
35 | |||
36 | /** | ||
37 | * {@inheritdoc} | ||
38 | */ | ||
39 | public function exists($name) | ||
40 | { | ||
41 | return true; | ||
42 | } | ||
43 | |||
44 | /** | ||
45 | * {@inheritdoc} | ||
46 | */ | ||
47 | public function getCacheKey($name) | ||
48 | { | ||
49 | return $name; | ||
50 | } | ||
51 | |||
52 | /** | ||
53 | * {@inheritdoc} | ||
54 | */ | ||
55 | public function isFresh($name, $time) | ||
56 | { | ||
57 | return true; | ||
58 | } | ||
59 | } | ||