1 | <?php |
||
19 | abstract class AbstractLoader implements |
||
20 | LoggerAwareInterface, |
||
21 | LoaderInterface |
||
22 | { |
||
23 | use LoggerAwareTrait; |
||
24 | |||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | private $basePath = ''; |
||
29 | |||
30 | /** |
||
31 | * @var string[] |
||
32 | */ |
||
33 | private $paths = []; |
||
34 | |||
35 | /** |
||
36 | * @var array |
||
37 | */ |
||
38 | private $dynamicTemplates = []; |
||
39 | |||
40 | /** |
||
41 | * Default constructor, if none is provided by the concrete class implementations. |
||
42 | * |
||
43 | * ## Required dependencies |
||
44 | * - `logger` A PSR-3 logger |
||
45 | * |
||
46 | * @param array $data The class dependencies map. |
||
47 | */ |
||
48 | public function __construct(array $data = null) |
||
54 | |||
55 | /** |
||
56 | * Load a template content |
||
57 | * |
||
58 | * @deprecated $GLOBALS['widget_template'] |
||
59 | * |
||
60 | * @param string $ident The template ident to load and render. |
||
61 | * @throws InvalidArgumentException If the dynamic template identifier is not a string. |
||
62 | * @return string |
||
63 | */ |
||
64 | public function load($ident) |
||
104 | |||
105 | /** |
||
106 | * @param string $varName The name of the variable to get template ident from. |
||
107 | * @throws InvalidArgumentException If the var name is not a string. |
||
108 | * @return string |
||
109 | */ |
||
110 | public function dynamicTemplate($varName) |
||
124 | |||
125 | /** |
||
126 | * @deprecated $GLOBALS['widget_template'] |
||
127 | * |
||
128 | * @param string $varName The name of the variable to set this template unto. |
||
129 | * @param string|null $templateIdent The "dynamic template" to set or NULL to clear. |
||
130 | * @throws InvalidArgumentException If var name is not a string |
||
131 | * or if the template is not a string (and not null). |
||
132 | * @return void |
||
133 | */ |
||
134 | public function setDynamicTemplate($varName, $templateIdent) |
||
160 | |||
161 | /** |
||
162 | * @deprecated $GLOBALS['widget_template'] |
||
163 | * |
||
164 | * @param string $varName The name of the variable to remove. |
||
165 | * @throws InvalidArgumentException If var name is not a string. |
||
166 | * @return void |
||
167 | */ |
||
168 | public function removeDynamicTemplate($varName) |
||
183 | |||
184 | /** |
||
185 | * @deprecated $GLOBALS['widget_template'] |
||
186 | * |
||
187 | * @return void |
||
188 | */ |
||
189 | public function clearDynamicTemplates() |
||
196 | |||
197 | /** |
||
198 | * @return string |
||
199 | */ |
||
200 | protected function basePath() |
||
204 | |||
205 | /** |
||
206 | * @param string $basePath The base path to set. |
||
207 | * @throws InvalidArgumentException If the base path parameter is not a string. |
||
208 | * @return LoaderInterface Chainable |
||
209 | */ |
||
210 | private function setBasePath($basePath) |
||
221 | |||
222 | /** |
||
223 | * @return string[] |
||
224 | */ |
||
225 | protected function paths() |
||
229 | |||
230 | /** |
||
231 | * @param string[] $paths The list of path to add. |
||
232 | * @return LoaderInterface Chainable |
||
233 | */ |
||
234 | private function setPaths(array $paths) |
||
244 | |||
245 | /** |
||
246 | * @param string $path The path to add to the load. |
||
247 | * @return LoaderInterface Chainable |
||
248 | */ |
||
249 | private function addPath($path) |
||
255 | |||
256 | /** |
||
257 | * @param string $path The path to resolve. |
||
258 | * @throws InvalidArgumentException If the path argument is not a string. |
||
259 | * @return string |
||
260 | */ |
||
261 | private function resolvePath($path) |
||
277 | |||
278 | /** |
||
279 | * Determine if the variable is a template literal. |
||
280 | * |
||
281 | * This method looks for any line-breaks in the given string, |
||
282 | * which a file path would not allow. |
||
283 | * |
||
284 | * @param string $ident The template being evaluated. |
||
285 | * @return boolean Returns TRUE if the given value is most likely the template contents |
||
286 | * as opposed to a template identifier (file path). |
||
287 | */ |
||
288 | protected function isTemplateString($ident) |
||
292 | |||
293 | /** |
||
294 | * Get the template file (full path + filename) to load from an ident. |
||
295 | * |
||
296 | * This method first generates the filename for an identifier and search for it in all of the loader's paths. |
||
297 | * |
||
298 | * @param string $ident The template identifier to load. |
||
299 | * @throws InvalidArgumentException If the template ident is not a string. |
||
300 | * @return string|null The full path + filename of the found template. Null if nothing was found. |
||
301 | */ |
||
302 | protected function findTemplateFile($ident) |
||
322 | |||
323 | /** |
||
324 | * @param string $ident The template identifier to convert to a filename. |
||
325 | * @return string |
||
326 | */ |
||
327 | abstract protected function filenameFromIdent($ident); |
||
328 | } |
||
329 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.