| Conditions | 6 |
| Paths | 6 |
| Total Lines | 29 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 25 | public function prepandRoutes(IRouter $router, array $routes) |
||
| 26 | { |
||
| 27 | if (empty($routes)) { |
||
| 28 | return; |
||
| 29 | } |
||
| 30 | |||
| 31 | if (!($router instanceof \Traversable) || !($router instanceof \ArrayAccess)) { |
||
| 32 | throw new ApiRouteWrongRouterException(sprintf( |
||
| 33 | 'ApiRoutesResolver can not add ApiRoutes to your router. Use for example %s instead', |
||
| 34 | RouteList::class |
||
| 35 | )); |
||
| 36 | } |
||
| 37 | |||
| 38 | $user_routes = $this->findAndDestroyUserRoutes($router); |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Add ApiRoutes first |
||
| 42 | */ |
||
| 43 | foreach ($routes as $route) { |
||
| 44 | $router[] = $route; |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * User routes on second place |
||
| 49 | */ |
||
| 50 | foreach ($user_routes as $route) { |
||
| 51 | $router[] = $route; |
||
| 52 | } |
||
| 53 | } |
||
| 54 | |||
| 78 |