1 | <?php |
||
16 | class Config { |
||
17 | use |
||
18 | Singleton; |
||
19 | const SYSTEM_MODULE = 'System'; |
||
20 | const SYSTEM_THEME = 'CleverStyle'; |
||
21 | /** |
||
22 | * Most of general configuration properties |
||
23 | * |
||
24 | * @var mixed[] |
||
25 | */ |
||
26 | public $core = []; |
||
27 | /** |
||
28 | * Configuration of databases, except the main database, parameters of which are stored in configuration file |
||
29 | * |
||
30 | * @var mixed[] |
||
31 | */ |
||
32 | public $db = []; |
||
33 | /** |
||
34 | * Configuration of storages, except the main storage, parameters of which are stored in configuration file |
||
35 | * |
||
36 | * @var mixed[] |
||
37 | */ |
||
38 | public $storage = []; |
||
39 | /** |
||
40 | * Internal structure of components parameters |
||
41 | * |
||
42 | * @var mixed[] |
||
43 | */ |
||
44 | public $components = []; |
||
45 | /** |
||
46 | * Array of all domains, which allowed to access the site |
||
47 | * |
||
48 | * Contains keys: |
||
49 | * * count - Total count |
||
50 | * * http - Insecure (http) domains |
||
51 | * * https - Secure (https) domains |
||
52 | * |
||
53 | * @var array |
||
54 | */ |
||
55 | public $mirrors = [ |
||
56 | 'count' => 0, |
||
57 | 'http' => [], |
||
58 | 'https' => [] |
||
59 | ]; |
||
60 | /** |
||
61 | * Loading of configuration, initialization of $Config, $Cache, $L and Page objects, Routing processing |
||
62 | * |
||
63 | * @throws ExitException |
||
64 | */ |
||
65 | protected function construct () { |
||
90 | /** |
||
91 | * Is used to fill `$this->mirrors` using current configuration |
||
92 | */ |
||
93 | protected function fill_mirrors () { |
||
101 | /** |
||
102 | * Reloading of settings cache |
||
103 | * |
||
104 | * @return bool |
||
105 | * |
||
106 | * @throws ExitException |
||
107 | */ |
||
108 | protected function load_config_from_db () { |
||
133 | /** |
||
134 | * Applying settings without saving changes into db |
||
135 | * |
||
136 | * @return bool |
||
137 | * |
||
138 | * @throws ExitException |
||
139 | */ |
||
140 | function apply () { |
||
143 | /** |
||
144 | * Applying settings without saving changes into db |
||
145 | * |
||
146 | * @param bool $cache_not_saved_mark |
||
147 | * |
||
148 | * @return bool |
||
149 | * |
||
150 | * @throws ExitException |
||
151 | */ |
||
152 | protected function apply_internal ($cache_not_saved_mark = true) { |
||
175 | /** |
||
176 | * Saving settings |
||
177 | * |
||
178 | * @return bool |
||
179 | * |
||
180 | * @throws ExitException |
||
181 | */ |
||
182 | function save () { |
||
213 | /** |
||
214 | * Whether configuration was applied (not saved) and can be canceled |
||
215 | * |
||
216 | * @return bool |
||
217 | */ |
||
218 | function cancel_available () { |
||
221 | /** |
||
222 | * Canceling of applied settings |
||
223 | * |
||
224 | * @return bool |
||
225 | * |
||
226 | * @throws ExitException |
||
227 | */ |
||
228 | function cancel () { |
||
231 | /** |
||
232 | * Get base url of current mirror including language suffix |
||
233 | * |
||
234 | * @return string |
||
235 | */ |
||
236 | function base_url () { |
||
250 | /** |
||
251 | * Get base url of main domain |
||
252 | * |
||
253 | * @return string |
||
254 | */ |
||
255 | function core_url () { |
||
261 | /** |
||
262 | * Get object for getting db and storage configuration of module |
||
263 | * |
||
264 | * @param string $module_name |
||
265 | * |
||
266 | * @return Config\Module_Properties |
||
267 | */ |
||
268 | function module ($module_name) { |
||
274 | } |
||
275 |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.