Total Complexity | 16 |
Total Lines | 48 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | trait CheckTrait{ |
||
8 | |||
9 | protected function check_protocol(string $expected, string $current) |
||
10 | { |
||
11 | if($expected !== $current){ |
||
12 | throw new Exception('Page not found.',404); |
||
13 | } |
||
14 | } |
||
15 | |||
16 | protected function check_name(string $route_name){ |
||
19 | } |
||
20 | } |
||
21 | |||
22 | protected function check_filtering(array $route) |
||
23 | { |
||
24 | $filters = (is_array($route['filters'])) ? $route['filters'] : [ $route['filters'] ]; |
||
25 | |||
26 | foreach($filters as $filter){ |
||
27 | if(is_null($filter)){ |
||
28 | continue; |
||
29 | } |
||
30 | $this->filter->filtering($filter); |
||
31 | } |
||
32 | } |
||
33 | |||
34 | protected function check_config() |
||
35 | { |
||
36 | if(!defined('ROUTER_CONFIG')){ |
||
37 | throw new Exception("Information for loading routes has not been defined."); |
||
38 | } |
||
39 | } |
||
40 | |||
41 | protected function check_role() |
||
45 | } |
||
46 | } |
||
47 | |||
48 | protected function hasProtocol(array $route, string $currentProtocol) |
||
59 | } |