1 | <?php |
||
19 | final class Scanner |
||
20 | { |
||
21 | /** |
||
22 | * Return all sections (app & plugins) with an Template directory. |
||
23 | * |
||
24 | * @return array |
||
25 | */ |
||
26 | 5 | public static function all(): array |
|
47 | |||
48 | /** |
||
49 | * Return all templates for a given plugin. |
||
50 | * |
||
51 | * @param string $plugin The plugin to find all templates for. |
||
52 | * |
||
53 | * @return mixed |
||
54 | */ |
||
55 | 4 | public static function plugin($plugin) |
|
62 | |||
63 | /** |
||
64 | * Check sections a remove the ones without anything in them. |
||
65 | * |
||
66 | * @param array $sections Sections to check. |
||
67 | * |
||
68 | * @return array |
||
69 | */ |
||
70 | 5 | protected static function clearEmptySections(array $sections): array |
|
80 | |||
81 | /** |
||
82 | * Finds all plugins with a Template directory. |
||
83 | * |
||
84 | * @return array |
||
85 | */ |
||
86 | 5 | protected static function pluginsWithTemplates(): array |
|
100 | |||
101 | /** |
||
102 | * Iterage over the given path and return all matching .tpl files in it. |
||
103 | * |
||
104 | * @param string $path Path to iterate over. |
||
105 | * |
||
106 | * @return array |
||
107 | */ |
||
108 | 8 | protected static function iteratePath($path): array |
|
112 | |||
113 | /** |
||
114 | * Setup iterator for given path. |
||
115 | * |
||
116 | * @param string $path Path to setup iterator for. |
||
117 | * |
||
118 | * @return \Iterator |
||
119 | */ |
||
120 | 8 | protected static function setupIterator($path): Iterator |
|
133 | |||
134 | /** |
||
135 | * Walk over the iterator and compile all templates. |
||
136 | * |
||
137 | * @param \Iterator $iterator Iterator to walk. |
||
138 | * |
||
139 | * @return array |
||
140 | */ |
||
141 | 8 | protected static function walkIterator(Iterator $iterator): array |
|
162 | } |
||
163 |