@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @param array $routes |
27 | 27 | */ |
28 | - public function __construct(array $routes = []) |
|
28 | + public function __construct(array $routes = [ ]) |
|
29 | 29 | { |
30 | 30 | $this->routes = $routes; |
31 | 31 | } |
@@ -49,14 +49,14 @@ discard block |
||
49 | 49 | { |
50 | 50 | foreach (array_keys($routesConfig) as $k) { |
51 | 51 | $childRoutes = null; |
52 | - if (isset($routesConfig[$k]['child_routes']) && !empty($routesConfig[$k]['child_routes'])) { |
|
53 | - $childRoutes = $routesConfig[$k]['child_routes']; |
|
54 | - unset($routesConfig[$k]['child_routes']); |
|
52 | + if (isset($routesConfig[ $k ][ 'child_routes' ]) && !empty($routesConfig[ $k ][ 'child_routes' ])) { |
|
53 | + $childRoutes = $routesConfig[ $k ][ 'child_routes' ]; |
|
54 | + unset($routesConfig[ $k ][ 'child_routes' ]); |
|
55 | 55 | } |
56 | 56 | |
57 | - $routesConfig[$k]['name'] = $k; |
|
58 | - $route = $this->processRoute($routesConfig[$k], $parentRoute); |
|
59 | - if (!isset($routesConfig[$k]['may_terminate']) || false !== $routesConfig[$k]['may_terminate']) { |
|
57 | + $routesConfig[ $k ][ 'name' ] = $k; |
|
58 | + $route = $this->processRoute($routesConfig[ $k ], $parentRoute); |
|
59 | + if (!isset($routesConfig[ $k ][ 'may_terminate' ]) || false !== $routesConfig[ $k ][ 'may_terminate' ]) { |
|
60 | 60 | $routeCollection->addRoute($route); |
61 | 61 | } |
62 | 62 | |
@@ -76,12 +76,12 @@ discard block |
||
76 | 76 | */ |
77 | 77 | private function processRoute(array $routeConfig, Route $parentRoute = null) |
78 | 78 | { |
79 | - $name = $routeConfig['name']; |
|
80 | - $url = isset($routeConfig['options']['route']) ? $routeConfig['options']['route'] : ''; |
|
81 | - $controller = isset($routeConfig['options']['defaults']['controller']) |
|
82 | - ? $routeConfig['options']['defaults']['controller'] : null; |
|
83 | - $action = isset($routeConfig['options']['defaults']['action']) |
|
84 | - ? $routeConfig['options']['defaults']['action'] : null; |
|
79 | + $name = $routeConfig[ 'name' ]; |
|
80 | + $url = isset($routeConfig[ 'options' ][ 'route' ]) ? $routeConfig[ 'options' ][ 'route' ] : ''; |
|
81 | + $controller = isset($routeConfig[ 'options' ][ 'defaults' ][ 'controller' ]) |
|
82 | + ? $routeConfig[ 'options' ][ 'defaults' ][ 'controller' ] : null; |
|
83 | + $action = isset($routeConfig[ 'options' ][ 'defaults' ][ 'action' ]) |
|
84 | + ? $routeConfig[ 'options' ][ 'defaults' ][ 'action' ] : null; |
|
85 | 85 | |
86 | 86 | if (null !== $parentRoute) { |
87 | 87 | $name = $parentRoute->getName() . '/' . $name; |