1 | <?php |
||
18 | class Config { |
||
19 | use |
||
20 | Singleton; |
||
21 | const SYSTEM_MODULE = 'System'; |
||
22 | const SYSTEM_THEME = 'CleverStyle'; |
||
23 | /** |
||
24 | * Most of general configuration properties |
||
25 | * |
||
26 | * @var mixed[] |
||
27 | */ |
||
28 | public $core = []; |
||
29 | /** |
||
30 | * Configuration of databases, except the main database, parameters of which are stored in configuration file |
||
31 | * |
||
32 | * @var mixed[] |
||
33 | */ |
||
34 | public $db = []; |
||
35 | /** |
||
36 | * Configuration of storages, except the main storage, parameters of which are stored in configuration file |
||
37 | * |
||
38 | * @var mixed[] |
||
39 | */ |
||
40 | public $storage = []; |
||
41 | /** |
||
42 | * Internal structure of components parameters |
||
43 | * |
||
44 | * @var mixed[] |
||
45 | */ |
||
46 | public $components = []; |
||
47 | /** |
||
48 | * Array of all domains, which allowed to access the site |
||
49 | * |
||
50 | * Contains keys: |
||
51 | * * count - Total count |
||
52 | * * http - Insecure (http) domains |
||
53 | * * https - Secure (https) domains |
||
54 | * |
||
55 | * @var array |
||
56 | */ |
||
57 | public $mirrors = [ |
||
58 | 'count' => 0, |
||
59 | 'http' => [], |
||
60 | 'https' => [] |
||
61 | ]; |
||
62 | /** |
||
63 | * Loading of configuration, initialization of $Config, $Cache, $L and Page objects, Routing processing |
||
64 | * |
||
65 | * @throws ExitException |
||
66 | */ |
||
67 | protected function construct () { |
||
94 | /** |
||
95 | * Engine initialization (or reinitialization if necessary) |
||
96 | * |
||
97 | * @throws ExitException |
||
98 | */ |
||
99 | protected function init () { |
||
112 | /** |
||
113 | * Is used to fill `$this->mirrors` using current configuration |
||
114 | */ |
||
115 | protected function fill_mirrors () { |
||
123 | /** |
||
124 | * Reloading of settings cache |
||
125 | * |
||
126 | * @return bool |
||
127 | * |
||
128 | * @throws ExitException |
||
129 | */ |
||
130 | protected function load_config_from_db () { |
||
155 | /** |
||
156 | * Applying settings without saving changes into db |
||
157 | * |
||
158 | * @return bool |
||
159 | * |
||
160 | * @throws ExitException |
||
161 | */ |
||
162 | function apply () { |
||
165 | /** |
||
166 | * Applying settings without saving changes into db |
||
167 | * |
||
168 | * @param bool $cache_not_saved_mark |
||
169 | * |
||
170 | * @return bool |
||
171 | * |
||
172 | * @throws ExitException |
||
173 | */ |
||
174 | protected function apply_internal ($cache_not_saved_mark = true) { |
||
203 | /** |
||
204 | * Saving settings |
||
205 | * |
||
206 | * @return bool |
||
207 | * |
||
208 | * @throws ExitException |
||
209 | */ |
||
210 | function save () { |
||
241 | /** |
||
242 | * Whether configuration was applied (not saved) and can be canceled |
||
243 | * |
||
244 | * @return bool |
||
245 | */ |
||
246 | function cancel_available () { |
||
249 | /** |
||
250 | * Canceling of applied settings |
||
251 | * |
||
252 | * @return bool |
||
253 | * |
||
254 | * @throws ExitException |
||
255 | */ |
||
256 | function cancel () { |
||
259 | /** |
||
260 | * Get base url of current mirror including language suffix |
||
261 | * |
||
262 | * @return string |
||
263 | */ |
||
264 | function base_url () { |
||
278 | /** |
||
279 | * Get base url of main domain |
||
280 | * |
||
281 | * @return string |
||
282 | */ |
||
283 | function core_url () { |
||
289 | /** |
||
290 | * Get object for getting db and storage configuration of module |
||
291 | * |
||
292 | * @param string $module_name |
||
293 | * |
||
294 | * @return Config\Module_Properties |
||
295 | */ |
||
296 | function module ($module_name) { |
||
302 | } |
||
303 |
If you implement
__call
and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__call
is implemented by a parent class and only the child class knows which methods exist: