@@ -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 | /** |
@@ -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 | /** |
@@ -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; |
@@ -84,10 +84,10 @@ |
||
84 | 84 | $request = $this->getRequest(); |
85 | 85 | $data = $this->params()->fromPost(); |
86 | 86 | $match = false; |
87 | - if (isset($data['method']) && !empty($data['method']) && isset($data['url']) && !empty($data['url'])) { |
|
88 | - $match = $this->routeMatcher->match($data['method'], $data['url']); |
|
87 | + if (isset($data[ 'method' ]) && !empty($data[ 'method' ]) && isset($data[ 'url' ]) && !empty($data[ 'url' ])) { |
|
88 | + $match = $this->routeMatcher->match($data[ 'method' ], $data[ 'url' ]); |
|
89 | 89 | } |
90 | 90 | |
91 | - return new JsonModel(['match' => $match]); |
|
91 | + return new JsonModel([ 'match' => $match ]); |
|
92 | 92 | } |
93 | 93 | } |