1 | <?php |
||
22 | class Config { |
||
23 | use |
||
24 | CRUD, |
||
25 | Properties_getter, |
||
26 | Singleton; |
||
27 | const INIT_STATE_METHOD = 'init'; |
||
28 | const SYSTEM_MODULE = 'System'; |
||
29 | const SYSTEM_THEME = 'CleverStyle'; |
||
30 | /** |
||
31 | * @var Cache\Prefix |
||
32 | */ |
||
33 | protected $cache; |
||
34 | /** |
||
35 | * Most of general configuration properties |
||
36 | * |
||
37 | * @var array |
||
38 | */ |
||
39 | public $core = []; |
||
40 | /** |
||
41 | * @var array |
||
42 | */ |
||
43 | protected $core_internal = []; |
||
44 | /** |
||
45 | * @var string |
||
46 | */ |
||
47 | protected $last_language; |
||
48 | /** |
||
49 | * Configuration of databases, except the main database, parameters of which are stored in configuration file |
||
50 | * |
||
51 | * @var mixed[] |
||
52 | */ |
||
53 | public $db = []; |
||
54 | /** |
||
55 | * Configuration of storages, except the main storage, parameters of which are stored in configuration file |
||
56 | * |
||
57 | * @var mixed[] |
||
58 | */ |
||
59 | public $storage = []; |
||
60 | /** |
||
61 | * Internal structure of components parameters |
||
62 | * |
||
63 | * @var array[] |
||
64 | */ |
||
65 | public $components = []; |
||
66 | /** |
||
67 | * Array of all domains, which allowed to access the site |
||
68 | * |
||
69 | * Contains keys: |
||
70 | * * count - Total count |
||
71 | * * http - Insecure (http) domains |
||
72 | * * https - Secure (https) domains |
||
73 | * |
||
74 | * @var array |
||
75 | */ |
||
76 | public $mirrors; |
||
77 | protected $data_model = [ |
||
78 | 'domain' => 'text', |
||
79 | 'core' => 'json', |
||
80 | 'db' => 'json', |
||
81 | 'storage' => 'json', |
||
82 | 'components' => 'json' |
||
83 | ]; |
||
84 | protected $table = '[prefix]config'; |
||
85 | 4 | protected function cdb () { |
|
88 | /** |
||
89 | * Update multilingual options when language changes |
||
90 | */ |
||
91 | 54 | protected function init () { |
|
100 | /** |
||
101 | * Loading of configuration, initialization of $Config, $Cache, $L and Page objects, Routing processing |
||
102 | * |
||
103 | * @throws ExitException |
||
104 | */ |
||
105 | 54 | protected function construct () { |
|
116 | /** |
||
117 | * Reloading of settings cache |
||
118 | * |
||
119 | * @throws ExitException |
||
120 | */ |
||
121 | 54 | protected function load_configuration () { |
|
143 | /** |
||
144 | * Is used to fill `$this->mirrors` using current configuration |
||
145 | */ |
||
146 | 54 | protected function fill_mirrors () { |
|
179 | /** |
||
180 | * Get core options item |
||
181 | * |
||
182 | * @param string[]|string[][] $item |
||
183 | * |
||
184 | * @return mixed|mixed[]|null Core options items (or associative array of items) if exists or `null` otherwise (in case if `$item` is an array even one |
||
185 | * missing key will cause the whole thing to fail) |
||
186 | */ |
||
187 | 2 | public function core (...$item) { |
|
190 | /** |
||
191 | * Applying settings without saving changes into db |
||
192 | * |
||
193 | * @return bool |
||
194 | * |
||
195 | * @throws ExitException |
||
196 | */ |
||
197 | 2 | public function apply () { |
|
214 | /** |
||
215 | * Applying settings without saving changes into db |
||
216 | * |
||
217 | * @param bool $cache_not_saved_mark |
||
218 | * |
||
219 | * @return bool |
||
220 | * |
||
221 | * @throws ExitException |
||
222 | */ |
||
223 | 2 | protected function apply_internal ($cache_not_saved_mark = true) { |
|
246 | /** |
||
247 | * Saving settings |
||
248 | * |
||
249 | * @return bool |
||
250 | * |
||
251 | * @throws ExitException |
||
252 | */ |
||
253 | 2 | public function save () { |
|
277 | /** |
||
278 | * Whether configuration was applied (not saved) and can be canceled |
||
279 | * |
||
280 | * @return bool |
||
281 | */ |
||
282 | 2 | public function cancel_available () { |
|
285 | /** |
||
286 | * Canceling of applied settings |
||
287 | * |
||
288 | * @throws ExitException |
||
289 | */ |
||
290 | 2 | public function cancel () { |
|
294 | /** |
||
295 | * Get base url of current mirror including language suffix |
||
296 | * |
||
297 | * @return string |
||
298 | */ |
||
299 | 8 | public function base_url () { |
|
310 | /** |
||
311 | * Get base url of main domain |
||
312 | * |
||
313 | * @return string |
||
314 | */ |
||
315 | 14 | public function core_url () { |
|
319 | /** |
||
320 | * Get object for getting db and storage configuration of module |
||
321 | * |
||
322 | * @param string $module_name |
||
323 | * |
||
324 | * @return Config\Module_Properties |
||
325 | */ |
||
326 | 54 | public function module ($module_name) { |
|
333 | } |
||
334 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: