| Conditions | 4 |
| Paths | 4 |
| Total Lines | 26 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 21 | protected function sortRoutes(): bool |
||
| 22 | { |
||
| 23 | if($this->sorted()){ |
||
| 24 | return true; |
||
| 25 | } |
||
| 26 | |||
| 27 | $staticRoutes = []; |
||
| 28 | $paramRoutes = []; |
||
| 29 | |||
| 30 | foreach($this->getRoutes() as $r => $route){ |
||
| 31 | |||
| 32 | $path = urldecode(unserialize($route['uri'])->getPath()); |
||
| 33 | |||
| 34 | if(strstr($path,'{')){ |
||
| 35 | $paramRoutes[$this->getKeyArray(substr_count($path,'/') + substr_count($path,'{'),$paramRoutes)] = $route; |
||
| 36 | continue; |
||
| 37 | } |
||
| 38 | |||
| 39 | $staticRoutes[$this->getKeyArray(substr_count($path,'/'),$staticRoutes)] = $route; |
||
| 40 | } |
||
| 41 | |||
| 42 | rsort($paramRoutes); |
||
| 43 | rsort($staticRoutes); |
||
| 44 | |||
| 45 | $this->orderRoutes(array_merge($staticRoutes,$paramRoutes)); |
||
| 46 | return $this->sorted(true); |
||
| 47 | } |
||
| 70 |