1 | <?php |
||
26 | trait Route { |
||
27 | /** |
||
28 | * Current mirror according to configuration |
||
29 | * |
||
30 | * @var int |
||
31 | */ |
||
32 | public $mirror_index = -1; |
||
33 | /** |
||
34 | * Normalized processed representation of relative address, may differ from raw, should be used in most cases |
||
35 | * |
||
36 | * @var string |
||
37 | */ |
||
38 | public $path_normalized = ''; |
||
39 | /** |
||
40 | * Contains parsed route of current page url in form of array without module name and prefixes <i>admin</i>/<i>api</i> |
||
41 | * |
||
42 | * @var array |
||
43 | */ |
||
44 | public $route = []; |
||
45 | /** |
||
46 | * Like $route property, but excludes numerical items |
||
47 | * |
||
48 | * @var string[] |
||
49 | */ |
||
50 | public $route_path = []; |
||
51 | /** |
||
52 | * Like $route property, but only includes numerical items (opposite to route_path property) |
||
53 | * |
||
54 | * @var int[] |
||
55 | */ |
||
56 | public $route_ids = []; |
||
57 | /** |
||
58 | * Request to administration section |
||
59 | * |
||
60 | * @var bool |
||
61 | */ |
||
62 | public $admin_path; |
||
63 | /** |
||
64 | * Request to api section |
||
65 | * |
||
66 | * @var bool |
||
67 | */ |
||
68 | public $api_path; |
||
69 | /** |
||
70 | * Current module |
||
71 | * |
||
72 | * @var string |
||
73 | */ |
||
74 | public $current_module; |
||
75 | /** |
||
76 | * Home page |
||
77 | * |
||
78 | * @var bool |
||
79 | */ |
||
80 | public $home_page; |
||
81 | /** |
||
82 | * Initialize route based on system configuration, requires `::init_server()` being called first since uses its data |
||
83 | * |
||
84 | * @throws ExitException |
||
85 | */ |
||
86 | function init_route () { |
||
135 | /** |
||
136 | * Process raw relative route. |
||
137 | * |
||
138 | * As result returns current route in system in form of array, corrected page address, detects MODULE, that responsible for processing this url, |
||
139 | * whether this is API call, admin page, or home page |
||
140 | * |
||
141 | * @param string $path |
||
142 | * |
||
143 | * @return false|string[] Array contains next elements: `route`, `path_normalized`, `admin_path`, `api_path`, `current_module`, `home_page` |
||
144 | */ |
||
145 | function analyze_route_path ($path) { |
||
196 | /** |
||
197 | * @param Config $Config |
||
198 | * @param string $path_normalized |
||
199 | * |
||
200 | * @throws ExitException |
||
201 | */ |
||
202 | protected function handle_redirect ($Config, $path_normalized) { |
||
218 | /** |
||
219 | * Check whether referer is local |
||
220 | * |
||
221 | * @param Config $Config |
||
222 | * |
||
223 | * @return bool |
||
224 | */ |
||
225 | protected function is_referer_local ($Config) { |
||
243 | /** |
||
244 | * Determine module of current page based on page path and system configuration |
||
245 | * |
||
246 | * @param array $rc |
||
247 | * @param bool $home_page |
||
248 | * @param string $admin_path |
||
249 | * @param string $api_path |
||
250 | * |
||
251 | * @return mixed|string |
||
252 | */ |
||
253 | protected function determine_page_module (&$rc, &$home_page, $admin_path, $api_path) { |
||
271 | /** |
||
272 | * Get array of modules |
||
273 | * |
||
274 | * @param Config $Config |
||
275 | * @param bool $admin_path |
||
276 | * |
||
277 | * @return array Array of form [localized_module_name => module_name] |
||
278 | */ |
||
279 | protected function get_modules ($Config, $admin_path) { |
||
300 | } |
||
301 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountId
that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theid
property of an instance of theAccount
class. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.