1 | <?php |
||
18 | class Config extends AbstractConfig |
||
19 | { |
||
20 | /** |
||
21 | * All file formats supported by Config |
||
22 | * |
||
23 | * @var array |
||
24 | */ |
||
25 | private $supportedFileParsers = array( |
||
26 | 'Noodlehaus\FileParser\Php', |
||
27 | 'Noodlehaus\FileParser\Ini', |
||
28 | 'Noodlehaus\FileParser\Json', |
||
29 | 'Noodlehaus\FileParser\Xml', |
||
30 | 'Noodlehaus\FileParser\Yaml' |
||
31 | ); |
||
32 | |||
33 | /** |
||
34 | * Static method for loading a Config instance. |
||
35 | * |
||
36 | * @param string|array $path |
||
37 | * |
||
38 | * @return Config |
||
39 | */ |
||
40 | 3 | public static function load($path) |
|
44 | |||
45 | /** |
||
46 | * Loads a supported configuration file format. |
||
47 | * |
||
48 | * @param string|array $path |
||
49 | * |
||
50 | * @throws EmptyDirectoryException If `$path` is an empty directory |
||
51 | */ |
||
52 | 30 | public function __construct($path) |
|
78 | |||
79 | /** |
||
80 | 24 | * Gets a parser for a given file extension |
|
81 | * |
||
82 | 24 | * @param string $extension |
|
83 | * |
||
84 | 24 | * @return Noodlehaus\FileParser\FileParserInterface |
|
85 | 24 | * |
|
86 | * @throws UnsupportedFormatException If `$path` is an unsupported file format |
||
87 | 24 | */ |
|
88 | 18 | private function getParser($extension) |
|
100 | |||
101 | /** |
||
102 | * Gets an array of paths |
||
103 | * |
||
104 | * @param array $path |
||
105 | * |
||
106 | * @return array |
||
107 | * |
||
108 | * @throws FileNotFoundException If a file is not found at `$path` |
||
109 | */ |
||
110 | private function getPathFromArray($path) |
||
138 | |||
139 | /** |
||
140 | * Checks `$path` to see if it is either an array, a directory, or a file |
||
141 | * |
||
142 | * @param string|array $path |
||
143 | * |
||
144 | * @return array |
||
145 | * |
||
146 | * @throws EmptyDirectoryException If `$path` is an empty directory |
||
147 | * |
||
148 | * @throws FileNotFoundException If a file is not found at `$path` |
||
149 | */ |
||
150 | private function getValidPath($path) |
||
172 | } |
||
173 |