Version 1
[yaffs-website] / web / core / modules / system / tests / modules / twig_loader_test / src / Loader / TestLoader.php
1 <?php
2
3 namespace Drupal\twig_loader_test\Loader;
4
5 /**
6  * A test Twig loader.
7  */
8 class TestLoader implements \Twig_LoaderInterface, \Twig_ExistsLoaderInterface {
9
10   /**
11    * {@inheritdoc}
12    */
13   public function getSource($name) {
14     if ($name == 'kittens') {
15       return $name;
16     }
17     else {
18       return 'cats';
19     }
20   }
21
22   /**
23    * {@inheritdoc}
24    */
25   public function exists($name) {
26     return TRUE;
27   }
28
29   /**
30    * {@inheritdoc}
31    */
32   public function getCacheKey($name) {
33     return $name;
34   }
35
36   /**
37    * {@inheritdoc}
38    */
39   public function isFresh($name, $time) {
40     return TRUE;
41   }
42
43 }