1 | <?php |
||
9 | class TemplateViewComposer |
||
10 | { |
||
11 | /** |
||
12 | * @var ThemeManager |
||
13 | */ |
||
14 | private $themeManager; |
||
15 | |||
16 | /** |
||
17 | * @var FinderService |
||
18 | */ |
||
19 | private $finder; |
||
20 | |||
21 | public function __construct(ThemeManager $themeManager, FinderService $finder) |
||
26 | |||
27 | public function compose(View $view) |
||
31 | |||
32 | private function getTemplates() |
||
53 | |||
54 | /** |
||
55 | * Get the base path of the current theme. |
||
56 | * |
||
57 | * @return string |
||
58 | */ |
||
59 | private function getCurrentThemeBasePath() |
||
63 | |||
64 | /** |
||
65 | * Read template name defined in comments. |
||
66 | * |
||
67 | * @param $template |
||
68 | * |
||
69 | * @return string |
||
70 | */ |
||
71 | private function getTemplateName($template) |
||
81 | |||
82 | /** |
||
83 | * If the template name is not defined in comments, build a default. |
||
84 | * |
||
85 | * @param $template |
||
86 | * |
||
87 | * @return mixed |
||
88 | */ |
||
89 | private function getDefaultTemplateName($template) |
||
96 | |||
97 | /** |
||
98 | * Remove the extension from the filename. |
||
99 | * |
||
100 | * @param $template |
||
101 | * |
||
102 | * @return mixed |
||
103 | */ |
||
104 | private function removeExtensionsFromFilename($template) |
||
108 | |||
109 | /** |
||
110 | * Check if the relative path is not empty (meaning the template is in a directory). |
||
111 | * |
||
112 | * @param $relativePath |
||
113 | * |
||
114 | * @return bool |
||
115 | */ |
||
116 | private function hasSubdirectory($relativePath) |
||
120 | } |
||
121 |