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 | 'Noodlehaus\FileParser\Neon' |
||
32 | ); |
||
33 | |||
34 | /** |
||
35 | * Static method for loading a Config instance. |
||
36 | * |
||
37 | * @param string|array $path |
||
38 | * |
||
39 | * @return Config |
||
40 | 3 | */ |
|
41 | public static function load($path) |
||
45 | |||
46 | /** |
||
47 | * Loads a supported configuration file format. |
||
48 | * |
||
49 | * @param string|array $path |
||
50 | * |
||
51 | * @throws EmptyDirectoryException If `$path` is an empty directory |
||
52 | 33 | */ |
|
53 | public function __construct($path) |
||
75 | |||
76 | /** |
||
77 | * Gets a parser for a given file extension |
||
78 | * |
||
79 | * @param string $extension |
||
80 | * |
||
81 | * @return Noodlehaus\FileParser\FileParserInterface |
||
82 | * |
||
83 | * @throws UnsupportedFormatException If `$path` is an unsupported file format |
||
84 | 27 | */ |
|
85 | private function getParser($extension) |
||
106 | |||
107 | /** |
||
108 | * Gets an array of paths |
||
109 | * |
||
110 | * @param array $path |
||
111 | * |
||
112 | * @return array |
||
113 | * |
||
114 | * @throws FileNotFoundException If a file is not found at `$path` |
||
115 | 12 | */ |
|
116 | private function getPathFromArray($path) |
||
144 | |||
145 | /** |
||
146 | * Checks `$path` to see if it is either an array, a directory, or a file |
||
147 | * |
||
148 | * @param string|array $path |
||
149 | * |
||
150 | * @return array |
||
151 | * |
||
152 | * @throws EmptyDirectoryException If `$path` is an empty directory |
||
153 | * |
||
154 | * @throws FileNotFoundException If a file is not found at `$path` |
||
155 | 30 | */ |
|
156 | private function getValidPath($path) |
||
178 | } |
||
179 |