@@ -21,7 +21,7 @@ |
||
| 21 | 21 | public function indexAction() |
| 22 | 22 | { |
| 23 | 23 | $this->layout(Module::DEFAULT_LAYOUT); |
| 24 | - $view = new ViewModel([]); |
|
| 24 | + $view = new ViewModel([ ]); |
|
| 25 | 25 | $view->setTemplate(Package::FQPN . '/index/index'); |
| 26 | 26 | |
| 27 | 27 | return $view; |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | 42 | * @param FlatRouteCollection $routeCollection |
| 43 | - * @param array $routesConfig |
|
| 43 | + * @param RouteInterface $routesConfig |
|
| 44 | 44 | * @param array $parentRoutesConfig |
| 45 | 45 | */ |
| 46 | 46 | private function processRoutes(FlatRouteCollection $routeCollection, array $routesConfig, array $parentRoutesConfig = null) |
@@ -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; |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | { |
| 25 | 25 | /** @var array $config */ |
| 26 | 26 | $config = $serviceLocator->get('config'); |
| 27 | - $config = isset($config['router']['routes']) ? $config['router']['routes'] : []; |
|
| 27 | + $config = isset($config[ 'router' ][ 'routes' ]) ? $config[ 'router' ][ 'routes' ] : [ ]; |
|
| 28 | 28 | |
| 29 | 29 | /** @var RouteInterface $router */ |
| 30 | 30 | $router = $serviceLocator->get('router'); |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public function getModuleDependencies() |
| 34 | 34 | { |
| 35 | - return ['AssetManager']; |
|
| 35 | + return [ 'AssetManager' ]; |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | $currentRouteName = $this->getCurrentRouteName($e->getApplication()->getServiceManager()); |
| 60 | - $e->getViewModel()->setVariables(['__currentRouteName' => $currentRouteName]); |
|
| 60 | + $e->getViewModel()->setVariables([ '__currentRouteName' => $currentRouteName ]); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | * |
| 21 | 21 | * @param array $routes |
| 22 | 22 | */ |
| 23 | - public function __construct(array $routes = []) |
|
| 23 | + public function __construct(array $routes = [ ]) |
|
| 24 | 24 | { |
| 25 | 25 | $this->routes = $routes; |
| 26 | 26 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public function addRoute(Route $route) |
| 32 | 32 | { |
| 33 | - $this->routes[$route->getName()] = $route; |
|
| 33 | + $this->routes[ $route->getName() ] = $route; |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |