1 | <?php |
||
19 | class Config implements ConfigInterface |
||
20 | { |
||
21 | /** @var array */ |
||
22 | private $pathMap = []; |
||
23 | /** @var array */ |
||
24 | private $rawConfig; |
||
25 | |||
26 | /** |
||
27 | * Config constructor. |
||
28 | * |
||
29 | * @param array $config |
||
30 | */ |
||
31 | 9 | public function __construct(array $config) |
|
36 | |||
37 | /** |
||
38 | * Processes the config into a one dimensional array. |
||
39 | * |
||
40 | * @param $path |
||
41 | * @param $config |
||
42 | */ |
||
43 | 9 | private function processConfig($path, $config) |
|
53 | |||
54 | /** |
||
55 | * Checks whether the key-path does exist or not. |
||
56 | * |
||
57 | * @param string $path |
||
58 | * |
||
59 | * @return bool |
||
60 | */ |
||
61 | 7 | public function has($path) |
|
65 | |||
66 | /** |
||
67 | * Retrieves configuration data for a specific key. |
||
68 | * |
||
69 | * @param string $path |
||
70 | * |
||
71 | * @throws InvalidArgumentException |
||
72 | * |
||
73 | * @return mixed |
||
74 | */ |
||
75 | 6 | public function getData($path) |
|
83 | |||
84 | /** |
||
85 | * Returns the configuration instance for a specific key. Also add the possibility to merge additional information |
||
86 | * into it. |
||
87 | * |
||
88 | * @param string $path |
||
89 | * |
||
90 | * @throws InvalidArgumentException |
||
91 | * |
||
92 | * @return mixed |
||
93 | */ |
||
94 | 2 | public function getConfig($path) |
|
102 | |||
103 | /** |
||
104 | * Returns the stored raw config array. |
||
105 | * |
||
106 | * @return array |
||
107 | */ |
||
108 | 1 | public function toArray() |
|
112 | } |
||
113 |