1 | <?php |
||
14 | class TwitalLoader implements \Twig_LoaderInterface, \Twig_ExistsLoaderInterface, \Twig_SourceContextLoaderInterface |
||
15 | { |
||
16 | /** |
||
17 | * Array of patterns used to decide if a template is twital-compilable or not. |
||
18 | * Items are strings or callbacks |
||
19 | * |
||
20 | * @var array |
||
21 | */ |
||
22 | protected $sourceAdapters = array(); |
||
23 | |||
24 | /** |
||
25 | * The wrapped Twig loader |
||
26 | * |
||
27 | * @var \Twig_LoaderInterface |
||
28 | */ |
||
29 | protected $loader; |
||
30 | |||
31 | /** |
||
32 | * The internal Twital compiler |
||
33 | * |
||
34 | * @var Twital |
||
35 | */ |
||
36 | protected $twital; |
||
37 | |||
38 | /** |
||
39 | * Creates a new Twital loader. |
||
40 | * @param \Twig_LoaderInterface $loader |
||
41 | * @param Twital $twital |
||
42 | * @param bool $addDefaults If NULL, some standard rules will be used (`*.twital.*` and `*.twital`). |
||
43 | */ |
||
44 | 45 | public function __construct(\Twig_LoaderInterface $loader = null, Twital $twital = null, $addDefaults = true) |
|
59 | |||
60 | 28 | public function getSourceContext($name) |
|
77 | |||
78 | /** |
||
79 | * Add a new pattern that can decide if a template is twital-compilable or not. |
||
80 | * If $pattern is a string, then must be a valid regex that matches the template filename. |
||
81 | * If $pattern is a callback, then must return true if the template is compilable, false otherwise. |
||
82 | * |
||
83 | * @param string|callback $pattern |
||
84 | * @param SourceAdapter $adapter |
||
85 | * @return TwitalLoader |
||
86 | */ |
||
87 | 43 | public function addSourceAdapter($pattern, SourceAdapter $adapter) |
|
93 | |||
94 | /** |
||
95 | * Get all patterns used to choose if a template is twital-compilable or not |
||
96 | * |
||
97 | * @return array: |
||
98 | */ |
||
99 | 1 | public function getSourceAdapters() |
|
103 | |||
104 | /** |
||
105 | * Decide if a template is twital-compilable or not. |
||
106 | * |
||
107 | * @param string $name |
||
108 | * @return SourceAdapter |
||
109 | */ |
||
110 | 31 | public function getSourceAdapter($name) |
|
120 | |||
121 | /** |
||
122 | * {@inheritdoc} |
||
123 | */ |
||
124 | public function getSource($name) |
||
128 | |||
129 | /** |
||
130 | * {@inheritdoc} |
||
131 | */ |
||
132 | 35 | public function getCacheKey($name) |
|
136 | |||
137 | /** |
||
138 | * {@inheritdoc} |
||
139 | */ |
||
140 | public function isFresh($name, $time) |
||
144 | |||
145 | /** |
||
146 | * {@inheritdoc} |
||
147 | */ |
||
148 | 2 | public function exists($name) |
|
162 | |||
163 | /** |
||
164 | * Get the wrapped Twig loader |
||
165 | * |
||
166 | * @return \Twig_LoaderInterface |
||
167 | */ |
||
168 | 1 | public function getLoader() |
|
172 | |||
173 | /** |
||
174 | * Set the wrapped Twig loader |
||
175 | * |
||
176 | * @param \Twig_LoaderInterface $loader |
||
177 | * @return TwitalLoader |
||
178 | */ |
||
179 | 1 | public function setLoader(\Twig_LoaderInterface $loader) |
|
185 | |||
186 | /** |
||
187 | * @return Twital |
||
188 | */ |
||
189 | 25 | public function getTwital() |
|
197 | |||
198 | } |
||
199 |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.