1 | <?php |
||
36 | final class Konfig extends AbstractKonfig |
||
37 | { |
||
38 | /** |
||
39 | * Array of file parsers objects. |
||
40 | * |
||
41 | * @var array|null |
||
42 | * |
||
43 | * @since 0.1.0 |
||
44 | */ |
||
45 | protected $fileParsers; |
||
46 | |||
47 | /** |
||
48 | * Stores loaded configuration files. |
||
49 | * |
||
50 | * @var array Array of loaded configuration files |
||
51 | * |
||
52 | * @since 0.1.0 |
||
53 | */ |
||
54 | protected static $loadedFiles = []; |
||
55 | |||
56 | /** |
||
57 | * Array of loaded data. |
||
58 | * |
||
59 | * @var array|null |
||
60 | * |
||
61 | * @since 0.1.0 |
||
62 | */ |
||
63 | protected static $loadedData = null; |
||
64 | |||
65 | /** |
||
66 | * Loads a supported configuration file format. |
||
67 | * |
||
68 | * @param string|array|mixed $path String file | configuration array |
||
69 | * | Konfig instance | configuration array | Konfig instance |
||
70 | * @param array $parsers Parsers |
||
71 | * @param bool $overwrite Whether to overwrite existing values |
||
72 | * @param bool $cache Allow caching |
||
73 | * |
||
74 | 33 | * @throws EmptyDirectoryException If `$path` is an empty directory |
|
75 | */ |
||
76 | 33 | public function __construct( |
|
114 | |||
115 | /** |
||
116 | * Static method for loading a Konfig instance. |
||
117 | * |
||
118 | * @param string|array|mixed $path string file | configuration array |
||
119 | * | Konfig instance |
||
120 | 3 | * @param array $parsers Parsers to use with Konfig |
|
121 | * @param bool $overwrite Whether to overwrite existing values |
||
122 | * @param bool $cache Allow caching |
||
123 | * |
||
124 | * @return Konfig |
||
125 | */ |
||
126 | 3 | public static function load( |
|
134 | |||
135 | /** |
||
136 | * Static method for getting loaded Konfig files. |
||
137 | * |
||
138 | * @return array |
||
139 | */ |
||
140 | public static function loaded() |
||
144 | |||
145 | /** |
||
146 | * Get file parsers. |
||
147 | * |
||
148 | * @return FileParser[] |
||
149 | * |
||
150 | * @since 0.1.0 |
||
151 | * @codeCoverageIgnore |
||
152 | */ |
||
153 | public function getFileParsers() |
||
157 | |||
158 | /** |
||
159 | * Add file parsers. |
||
160 | * |
||
161 | * @param FileParser $fileParser Parser |
||
162 | * |
||
163 | * @return void Void |
||
164 | * @since 0.1.0 |
||
165 | * @codeCoverageIgnore |
||
166 | */ |
||
167 | protected function addFileParser(FileParser $fileParser) |
||
171 | |||
172 | /** |
||
173 | * Set file parsers. |
||
174 | * |
||
175 | * @param array $fileParsers Parsers array |
||
176 | * |
||
177 | * @return void Void |
||
178 | * @since 0.1.0 |
||
179 | * @codeCoverageIgnore |
||
180 | */ |
||
181 | protected function setFileParsers(array $fileParsers = []) |
||
202 | |||
203 | /** |
||
204 | * Gets a parser for a given file extension. |
||
205 | * |
||
206 | * @param string $ext File extension |
||
207 | * |
||
208 | * @return FileParser |
||
209 | * |
||
210 | * @throws Exception If `$ext` is empty |
||
211 | * @throws UnsupportedFileFormatException If `$path` |
||
212 | * is an unsupported file format |
||
213 | * @codeCoverageIgnore |
||
214 | */ |
||
215 | private function getParser($ext = null) |
||
241 | |||
242 | /** |
||
243 | * Gets an array of paths. |
||
244 | * |
||
245 | * @param array $path Path to analyze and handle |
||
246 | * |
||
247 | * @return array |
||
248 | * |
||
249 | * @throws FileNotFoundException If a file is not found in `$path` |
||
250 | */ |
||
251 | private function pathFromArray($path) |
||
285 | |||
286 | /** |
||
287 | * Checks `$path` to see if it is either an array, a directory, or a file. |
||
288 | * |
||
289 | * @param string|array $path Path to analyze and handle |
||
290 | 30 | * |
|
291 | * @return array |
||
292 | * |
||
293 | 30 | * @throws EmptyDirectoryException If `$path` is an empty directory |
|
294 | 12 | * @throws FileNotFoundException If a file is not found at `$path` |
|
295 | */ |
||
296 | private function getValidPath($path) |
||
325 | |||
326 | /** |
||
327 | * __toString. |
||
328 | * |
||
329 | * @return string |
||
330 | * @since 0.1.2 |
||
331 | * @codeCoverageIgnore |
||
332 | */ |
||
333 | public function __toString() |
||
337 | } |
||
338 | |||
340 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.