@@ -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; |
@@ -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 | /** |
@@ -47,14 +47,14 @@ discard block |
||
47 | 47 | { |
48 | 48 | foreach (array_keys($routesConfig) as $k) { |
49 | 49 | $childRoutes = null; |
50 | - if (isset($routesConfig[$k]['child_routes']) && !empty($routesConfig[$k]['child_routes'])) { |
|
51 | - $childRoutes = $routesConfig[$k]['child_routes']; |
|
52 | - unset($routesConfig[$k]['child_routes']); |
|
50 | + if (isset($routesConfig[ $k ][ 'child_routes' ]) && !empty($routesConfig[ $k ][ 'child_routes' ])) { |
|
51 | + $childRoutes = $routesConfig[ $k ][ 'child_routes' ]; |
|
52 | + unset($routesConfig[ $k ][ 'child_routes' ]); |
|
53 | 53 | } |
54 | 54 | |
55 | - $routesConfig[$k]['name'] = $k; |
|
56 | - $route = $this->processRoute($routesConfig[$k], $parentRoute); |
|
57 | - if (!isset($routesConfig[$k]['may_terminate']) || false !== $routesConfig[$k]['may_terminate']) { |
|
55 | + $routesConfig[ $k ][ 'name' ] = $k; |
|
56 | + $route = $this->processRoute($routesConfig[ $k ], $parentRoute); |
|
57 | + if (!isset($routesConfig[ $k ][ 'may_terminate' ]) || false !== $routesConfig[ $k ][ 'may_terminate' ]) { |
|
58 | 58 | $routeCollection->addRoute($route); |
59 | 59 | } |
60 | 60 | |
@@ -74,12 +74,12 @@ discard block |
||
74 | 74 | */ |
75 | 75 | private function processRoute(array $routeConfig, Route $parentRoute = null) |
76 | 76 | { |
77 | - $name = $routeConfig['name']; |
|
78 | - $url = isset($routeConfig['options']['route']) ? $routeConfig['options']['route'] : ''; |
|
79 | - $controller = isset($routeConfig['options']['defaults']['controller']) |
|
80 | - ? $routeConfig['options']['defaults']['controller'] : null; |
|
81 | - $action = isset($routeConfig['options']['defaults']['action']) |
|
82 | - ? $routeConfig['options']['defaults']['action'] : null; |
|
77 | + $name = $routeConfig[ 'name' ]; |
|
78 | + $url = isset($routeConfig[ 'options' ][ 'route' ]) ? $routeConfig[ 'options' ][ 'route' ] : ''; |
|
79 | + $controller = isset($routeConfig[ 'options' ][ 'defaults' ][ 'controller' ]) |
|
80 | + ? $routeConfig[ 'options' ][ 'defaults' ][ 'controller' ] : null; |
|
81 | + $action = isset($routeConfig[ 'options' ][ 'defaults' ][ 'action' ]) |
|
82 | + ? $routeConfig[ 'options' ][ 'defaults' ][ 'action' ] : null; |
|
83 | 83 | |
84 | 84 | if (null !== $parentRoute) { |
85 | 85 | $name = $parentRoute->getName() . '/' . $name; |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | { |
83 | 83 | $data = $this->params()->fromQuery(); |
84 | 84 | $route = null; |
85 | - if (isset($data['method']) && !empty($data['method']) && isset($data['url']) && !empty($data['url'])) { |
|
86 | - if (null !== ($routeName = $this->routeMatcher->match($data['method'], $data['url']))) { |
|
85 | + if (isset($data[ 'method' ]) && !empty($data[ 'method' ]) && isset($data[ 'url' ]) && !empty($data[ 'url' ])) { |
|
86 | + if (null !== ($routeName = $this->routeMatcher->match($data[ 'method' ], $data[ 'url' ]))) { |
|
87 | 87 | $route = $this->routeCollection->getRoute($routeName); |
88 | 88 | $route = [ |
89 | 89 | 'name' => $route->getName(), |
@@ -94,6 +94,6 @@ discard block |
||
94 | 94 | } |
95 | 95 | } |
96 | 96 | |
97 | - return new JsonModel(['requestedRouteData' => $data, 'routeMatch' => $route]); |
|
97 | + return new JsonModel([ 'requestedRouteData' => $data, 'routeMatch' => $route ]); |
|
98 | 98 | } |
99 | 99 | } |
@@ -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 | /** |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function getRoute($routeName) |
42 | 42 | { |
43 | - if (!isset($this->routes[$routeName])) { |
|
43 | + if (!isset($this->routes[ $routeName ])) { |
|
44 | 44 | return null; |
45 | 45 | } |
46 | 46 | |
47 | - return $this->routes[$routeName]; |
|
47 | + return $this->routes[ $routeName ]; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |