1 | <?php |
||
15 | class FlysystemLoader implements Twig_LoaderInterface |
||
16 | { |
||
17 | /** |
||
18 | * @var Filesystem |
||
19 | */ |
||
20 | private $filesystem; |
||
21 | |||
22 | /** |
||
23 | * FlysystemLoader constructor. |
||
24 | * |
||
25 | * @param Filesystem $filesystem |
||
26 | */ |
||
27 | 12 | public function __construct(Filesystem $filesystem) |
|
31 | |||
32 | /** |
||
33 | * Gets the source code of a template, given its name. |
||
34 | * |
||
35 | * @param string $name The name of the template to load |
||
36 | * |
||
37 | * @return string The template source code |
||
38 | * |
||
39 | * @throws Twig_Error_Loader When $name is not found |
||
40 | */ |
||
41 | 6 | public function getSource($name) |
|
47 | |||
48 | /** |
||
49 | * Checks if the underlying flysystem contains a file of the given name. |
||
50 | * |
||
51 | * @param string $name |
||
52 | * |
||
53 | * @return \League\Flysystem\File|\League\Flysystem\Handler |
||
54 | * @throws Twig_Error_Loader |
||
55 | */ |
||
56 | 12 | protected function getFileOrFail($name) |
|
69 | |||
70 | /** |
||
71 | * Gets the cache key to use for the cache for a given template name. |
||
72 | * |
||
73 | * @param string $name The name of the template to load |
||
74 | * |
||
75 | * @return string The cache key |
||
76 | * |
||
77 | * @throws Twig_Error_Loader When $name is not found |
||
78 | */ |
||
79 | 3 | public function getCacheKey($name) |
|
85 | |||
86 | /** |
||
87 | * Returns true if the template is still fresh. |
||
88 | * |
||
89 | * @param string $name The template name |
||
90 | * @param int $time Timestamp of the last modification time of the |
||
91 | * cached template |
||
92 | * |
||
93 | * @return bool true if the template is fresh, false otherwise |
||
94 | * |
||
95 | * @throws Twig_Error_Loader When $name is not found |
||
96 | */ |
||
97 | 3 | public function isFresh($name, $time) |
|
103 | } |
||
104 |