1 | <?php |
||
7 | class Config implements ConfigInterface |
||
8 | { |
||
9 | |||
10 | /** |
||
11 | * @var Data |
||
12 | */ |
||
13 | protected $config; |
||
14 | |||
15 | /** |
||
16 | * TODO: make this private in 2.0 to prevent being saved as an array |
||
17 | * Making private now breaks backward compatibility |
||
18 | * |
||
19 | * @var Data |
||
20 | */ |
||
21 | protected $defaults; |
||
22 | |||
23 | /** |
||
24 | * Create a new configuration object, and initialize it with |
||
25 | * the provided nested array containing configuration data. |
||
26 | * |
||
27 | * @param array $data - Config data to store |
||
28 | */ |
||
29 | public function __construct(array $data = null) |
||
34 | |||
35 | /** |
||
36 | * {@inheritdoc} |
||
37 | */ |
||
38 | public function has($key) |
||
42 | |||
43 | /** |
||
44 | * {@inheritdoc} |
||
45 | */ |
||
46 | public function get($key, $defaultFallback = null) |
||
53 | |||
54 | /** |
||
55 | * {@inheritdoc} |
||
56 | */ |
||
57 | public function set($key, $value) |
||
62 | |||
63 | /** |
||
64 | * {@inheritdoc} |
||
65 | */ |
||
66 | public function import($data) |
||
70 | |||
71 | /** |
||
72 | * {@inheritdoc} |
||
73 | */ |
||
74 | public function replace($data) |
||
79 | |||
80 | /** |
||
81 | * {@inheritdoc} |
||
82 | */ |
||
83 | public function combine($data) |
||
90 | |||
91 | /** |
||
92 | * {@inheritdoc} |
||
93 | */ |
||
94 | public function export() |
||
98 | |||
99 | /** |
||
100 | * {@inheritdoc} |
||
101 | */ |
||
102 | public function hasDefault($key) |
||
106 | |||
107 | /** |
||
108 | * {@inheritdoc} |
||
109 | */ |
||
110 | public function getDefault($key, $defaultFallback = null) |
||
114 | |||
115 | /** |
||
116 | * {@inheritdoc} |
||
117 | */ |
||
118 | public function setDefault($key, $value) |
||
123 | |||
124 | /** |
||
125 | * Return the class $defaults property and ensure it's a Data object |
||
126 | * TODO: remove Data object validation in 2.0 |
||
127 | * |
||
128 | * @return Data |
||
129 | */ |
||
130 | protected function getDefaults() |
||
138 | |||
139 | /** |
||
140 | * Sets the $defaults class parameter |
||
141 | * TODO: remove support for array in 2.0 as this would currently break backward compatibility |
||
142 | * |
||
143 | * @param Data|array $defaults |
||
144 | * |
||
145 | * @throws \Exception |
||
146 | */ |
||
147 | protected function setDefaults($defaults) |
||
157 | } |
||
158 |