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