1 | <?php |
||
24 | trait FileAwareTrait |
||
25 | { |
||
26 | /** |
||
27 | * Loads a configuration file. |
||
28 | * |
||
29 | * @param string $path A path to a supported file. |
||
30 | * @throws InvalidArgumentException If the path is invalid. |
||
31 | * @return array An array on success. |
||
32 | */ |
||
33 | public function loadFile($path) |
||
70 | |||
71 | /** |
||
72 | * Load an INI file as an array. |
||
73 | * |
||
74 | * @param string $path A path to an INI file. |
||
75 | * @throws UnexpectedValueException If the file can not correctly be parsed into an array. |
||
76 | * @return array An array on success. |
||
77 | */ |
||
78 | private function loadIniFile($path) |
||
89 | |||
90 | /** |
||
91 | * Load a JSON file as an array. |
||
92 | * |
||
93 | * @param string $path A path to a JSON file. |
||
94 | * @throws UnexpectedValueException If the file can not correctly be parsed into an array. |
||
95 | * @return array An array on success. |
||
96 | * If the file is parsed as any other type, an empty array is returned. |
||
97 | */ |
||
98 | private function loadJsonFile($path) |
||
118 | |||
119 | /** |
||
120 | * Load a PHP file, maybe as an array. |
||
121 | * |
||
122 | * Note: |
||
123 | * - The context of $this is bound to the current object. |
||
124 | * - Data may be any value; the {@see self::addFile()} method will ignore |
||
125 | * anything that isn't an (associative) array. |
||
126 | * |
||
127 | * @param string $path A path to a PHP file. |
||
128 | * @throws UnexpectedValueException If the file can not correctly be parsed. |
||
129 | * @return array|Traversable An array or iterable object on success. |
||
130 | * If the file is parsed as any other type, an empty array is returned. |
||
131 | */ |
||
132 | private function loadPhpFile($path) |
||
150 | |||
151 | /** |
||
152 | * Load a YAML file as an array. |
||
153 | * |
||
154 | * @param string $path A path to a YAML/YML file. |
||
155 | * @throws LogicException If a YAML parser is unavailable. |
||
156 | * @throws UnexpectedValueException If the file can not correctly be parsed into an array. |
||
157 | * @return array An array on success. |
||
158 | * If the file is parsed as any other type, an empty array is returned. |
||
159 | */ |
||
160 | private function loadYamlFile($path) |
||
180 | } |
||
181 |