1 | <?php |
||
10 | final class FilesystemLoader implements Twig_LoaderInterface |
||
11 | { |
||
12 | /** |
||
13 | * @var string |
||
14 | */ |
||
15 | private $path; |
||
16 | |||
17 | /** |
||
18 | * @var array |
||
19 | */ |
||
20 | private $fileExtensions = []; |
||
21 | |||
22 | /** |
||
23 | * @var array |
||
24 | */ |
||
25 | private $cache = []; |
||
26 | |||
27 | 6 | public function __construct(string $path, array $fileExtensions = ['html.twig', 'twig']) |
|
32 | |||
33 | /** |
||
34 | * @inheritDoc |
||
35 | */ |
||
36 | 4 | public function getSourceContext($name) |
|
42 | |||
43 | /** |
||
44 | * @inheritDoc |
||
45 | */ |
||
46 | 1 | public function getCacheKey($name) |
|
50 | |||
51 | /** |
||
52 | * @inheritDoc |
||
53 | */ |
||
54 | 1 | public function isFresh($name, $time) |
|
58 | |||
59 | /** |
||
60 | * @inheritDoc |
||
61 | */ |
||
62 | 1 | public function exists($name) |
|
70 | |||
71 | /** |
||
72 | * @param string $name |
||
73 | * |
||
74 | * @return string |
||
75 | * |
||
76 | * @throws LoaderException |
||
77 | * When $name is not found. |
||
78 | */ |
||
79 | 5 | private function template($name) |
|
92 | |||
93 | /** |
||
94 | * @param string $name |
||
95 | * |
||
96 | * @return string|null |
||
97 | */ |
||
98 | 5 | private function findTemplate($name) |
|
111 | |||
112 | /** |
||
113 | * @param string $name |
||
114 | * |
||
115 | * @return Generator |
||
116 | */ |
||
117 | 5 | private function possibleTemplateFiles($name) |
|
125 | |||
126 | /** |
||
127 | * @param string $name |
||
128 | * |
||
129 | * @return string |
||
130 | */ |
||
131 | 5 | private function normalizeName($name) |
|
138 | } |
||
139 |