Total Complexity | 15 |
Total Lines | 51 |
Duplicated Lines | 0 % |
Changes | 6 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | trait CheckTrait |
||
8 | { |
||
9 | use Helper; |
||
10 | |||
11 | protected array $routesName = []; |
||
12 | |||
13 | protected function hasRouteName(string $name): void |
||
14 | { |
||
15 | if(!isset($this->routesName[$name])){ |
||
16 | throw new \RuntimeException("There is no route named with {$name}"); |
||
17 | } |
||
18 | } |
||
19 | |||
20 | protected function isInNameGroup(): void |
||
21 | { |
||
22 | if(!is_null($this->getGroup())){ |
||
23 | throw new \RuntimeException("It is not allowed to assign names to groups"); |
||
24 | } |
||
25 | } |
||
26 | |||
27 | protected function isInPseudGroup(): void |
||
28 | { |
||
29 | if(!is_null($this->getGroup())){ |
||
30 | throw new \RuntimeException("To assign actions before or after the execution of the route, use beforeGroup or afterGroup"); |
||
31 | } |
||
32 | } |
||
33 | |||
34 | protected function existRouteName(string $name): void |
||
35 | { |
||
36 | if(isset($this->routesName[$name])){ |
||
37 | throw new \RuntimeException("There is already a route named with {$name}"); |
||
38 | } |
||
39 | } |
||
40 | |||
41 | protected function checkMethod(array $route, $method): void |
||
51 | } |
||
52 | } |
||
53 | |||
54 | protected function throwCallable($value): void |
||
55 | { |
||
62 |