1 | <?php |
||
5 | abstract class ViewFactory implements ViewFactoryInterface |
||
6 | { |
||
7 | /** |
||
8 | * @var array $viewPaths An array of paths to search for views in. |
||
9 | */ |
||
10 | protected $viewPaths = []; |
||
11 | |||
12 | |||
13 | /** |
||
14 | * @var string $fileExtension The file extension to use when looking for views. |
||
15 | */ |
||
16 | protected $fileExtension = 'php'; |
||
17 | |||
18 | |||
19 | /** |
||
20 | * @var string|null $cacheDir A directory to cache rendered templates into (enables caching). |
||
21 | */ |
||
22 | protected $cacheDir = null; |
||
23 | |||
24 | |||
25 | /** |
||
26 | * @var string|null $partialsDir A directory where static partials are stored. |
||
27 | */ |
||
28 | protected $partialsDir = null; |
||
29 | |||
30 | |||
31 | /** |
||
32 | * @param string $fileName The name of the file to load. |
||
33 | * @return ViewInterface A view. |
||
34 | */ |
||
35 | abstract public function get($fileName); |
||
36 | |||
37 | |||
38 | /** |
||
39 | * @param array $viewPaths An array of paths to look for view files in. |
||
40 | */ |
||
41 | public function registerPaths(array $viewPaths) |
||
45 | |||
46 | |||
47 | /** |
||
48 | * @param string $viewPath A view path to check. |
||
49 | */ |
||
50 | public function addPath($viewPath) |
||
54 | |||
55 | |||
56 | /** |
||
57 | * Locates a view file and returns its full path. |
||
58 | * |
||
59 | * @param string $fileName The file name. |
||
60 | * @return string|false The location of the file, or false if it cannot be found. |
||
61 | * @throws \Exception |
||
62 | */ |
||
63 | protected function find($fileName) |
||
75 | } |
||
76 |