1 | <?php |
||
13 | class Configuration |
||
14 | { |
||
15 | /** |
||
16 | * Delimiter for configuration keys |
||
17 | * |
||
18 | * @var string |
||
19 | */ |
||
20 | const DELIMITER = '.'; |
||
21 | |||
22 | /** |
||
23 | * The configuration storage |
||
24 | * |
||
25 | * @var array |
||
26 | */ |
||
27 | protected $config = []; |
||
28 | |||
29 | /** |
||
30 | * Bootstraps the configuration |
||
31 | * |
||
32 | * @param array $config |
||
33 | */ |
||
34 | 16 | public function __construct(array $config = []) |
|
38 | |||
39 | /** |
||
40 | * Returns the configuration |
||
41 | * |
||
42 | * @return array |
||
43 | */ |
||
44 | 11 | public function getConfiguration() |
|
48 | |||
49 | /** |
||
50 | * Sets the configuration |
||
51 | * |
||
52 | * @param array $config |
||
53 | * @return array |
||
54 | */ |
||
55 | 16 | public function setConfiguration(array $config = []) |
|
59 | |||
60 | /** |
||
61 | * Sets a single configuration value |
||
62 | * |
||
63 | * @param string $key |
||
64 | * @param string $value |
||
65 | * @return void |
||
66 | */ |
||
67 | 5 | public function setConfigurationValue($key, $value) |
|
86 | |||
87 | /** |
||
88 | * Returns a single configuration value |
||
89 | * |
||
90 | * @param string $key |
||
91 | * @return mixed |
||
92 | */ |
||
93 | 8 | public function getConfigurationValue($key) |
|
108 | |||
109 | /** |
||
110 | * Checks if the configuration got the incoming key |
||
111 | * |
||
112 | * @param string $key |
||
113 | * @return bool |
||
114 | */ |
||
115 | 1 | public function hasConfigurationKey($key) |
|
132 | } |