Conditions | 3 |
Paths | 3 |
Total Lines | 21 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
11 | protected function sortRoutes(): void |
||
12 | { |
||
13 | $staticRoutes = []; |
||
14 | $paramRoutes = []; |
||
15 | |||
16 | foreach($this->getRoutes() as $r => $route){ |
||
17 | |||
18 | $path = urldecode($route['uri']->getPath()); |
||
19 | |||
20 | if(strstr($path,'{')){ |
||
21 | $paramRoutes[$this->getKeyArray(substr_count($path,'/') + substr_count($path,'{'),$paramRoutes)] = $route; |
||
22 | continue; |
||
23 | } |
||
24 | |||
25 | $staticRoutes[$this->getKeyArray(substr_count($path,'/'),$staticRoutes)] = $route; |
||
26 | } |
||
27 | |||
28 | rsort($paramRoutes); |
||
29 | rsort($staticRoutes); |
||
30 | |||
31 | $this->orderRoutes(array_merge($staticRoutes,$paramRoutes)); |
||
32 | } |
||
55 |