@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | /** |
21 | 21 | * @var array |
22 | 22 | */ |
23 | - private $matcher = ['matchController','matchTemplate']; |
|
23 | + private $matcher = ['matchController', 'matchTemplate']; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * @var array |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | /** |
42 | 42 | * @param string $matcher |
43 | 43 | */ |
44 | - public function addMatcher($matcher){ |
|
44 | + public function addMatcher($matcher) { |
|
45 | 45 | $this->matcher[] = $matcher; |
46 | 46 | } |
47 | 47 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * @param $class |
67 | 67 | * @return mixed|void |
68 | 68 | */ |
69 | - public function addDispatcher($method,$class){ |
|
69 | + public function addDispatcher($method, $class) { |
|
70 | 70 | $this->dispatcher[$method] = $class; |
71 | 71 | } |
72 | 72 | |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function match() |
77 | 77 | { |
78 | - foreach($this->matcher as $matcher){ |
|
79 | - if(call_user_func([$this,$matcher])) { |
|
78 | + foreach ($this->matcher as $matcher) { |
|
79 | + if (call_user_func([$this, $matcher])) { |
|
80 | 80 | $this->router->response->setStatusCode(202); |
81 | 81 | return true; |
82 | 82 | } |
@@ -91,12 +91,12 @@ discard block |
||
91 | 91 | { |
92 | 92 | foreach ($this->router->getConfig()['templateExtension'] as $extension) { |
93 | 93 | for ($i = 0; $i < $this->router->collection->countRoutes; ++$i) { |
94 | - $url = explode('/', str_replace($this->router->collection->getRoutes('prefix_' . $i), '',$this->router->route->getUrl())); |
|
94 | + $url = explode('/', str_replace($this->router->collection->getRoutes('prefix_' . $i), '', $this->router->route->getUrl())); |
|
95 | 95 | $end = array_pop($url); |
96 | - $url = implode('/', array_map('ucwords', $url)).'/'.$end; |
|
96 | + $url = implode('/', array_map('ucwords', $url)) . '/' . $end; |
|
97 | 97 | if (is_file(($template = rtrim($this->router->collection->getRoutes('view_dir_' . $i), '/') . $url . $extension))) { |
98 | - $block = $this->router->collection->getRoutes('block_'.$i); |
|
99 | - $viewDir = $this->router->collection->getRoutes('view_dir_'.$i); |
|
98 | + $block = $this->router->collection->getRoutes('block_' . $i); |
|
99 | + $viewDir = $this->router->collection->getRoutes('view_dir_' . $i); |
|
100 | 100 | $this->router->route->setTarget([ |
101 | 101 | 'dispatcher' => $this->dispatcher['matchTemplate'], |
102 | 102 | 'block' => $block, |
@@ -119,15 +119,15 @@ discard block |
||
119 | 119 | { |
120 | 120 | $routes = array_slice(explode('/', $this->router->route->getUrl()), 1); |
121 | 121 | $i = 0; |
122 | - do{ |
|
123 | - $route = ('/' . $routes[0] == $this->router->collection->getRoutes('prefix_' . $i)) ? array_slice($routes, 1) : $routes; |
|
122 | + do { |
|
123 | + $route = ('/' . $routes[0] == $this->router->collection->getRoutes('prefix_' . $i)) ? array_slice($routes, 1) : $routes; |
|
124 | 124 | if (isset($route[0])) { |
125 | - $class = (class_exists($this->router->collection->getRoutes('ctrl_namespace_' . $i). ucfirst($route[0]) . 'Controller')) |
|
126 | - ? $this->router->collection->getRoutes('ctrl_namespace_' . $i). ucfirst($route[0]) . 'Controller' |
|
125 | + $class = (class_exists($this->router->collection->getRoutes('ctrl_namespace_' . $i) . ucfirst($route[0]) . 'Controller')) |
|
126 | + ? $this->router->collection->getRoutes('ctrl_namespace_' . $i) . ucfirst($route[0]) . 'Controller' |
|
127 | 127 | : ucfirst($route[0]) . 'Controller'; |
128 | 128 | if (isset($route[1]) && method_exists($class, $route[1])) { |
129 | - $block = $this->router->collection->getRoutes('block_'.$i); |
|
130 | - $viewDir = $this->router->collection->getRoutes('view_dir_'.$i); |
|
129 | + $block = $this->router->collection->getRoutes('block_' . $i); |
|
130 | + $viewDir = $this->router->collection->getRoutes('view_dir_' . $i); |
|
131 | 131 | $this->router->route->setTarget([ |
132 | 132 | 'dispatcher' => $this->dispatcher['matchController'], |
133 | 133 | 'block' => $block, |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | } |
142 | 142 | } |
143 | 143 | ++$i; |
144 | - }while($i < $this->router->collection->countRoutes); |
|
144 | + }while ($i < $this->router->collection->countRoutes); |
|
145 | 145 | return false; |
146 | 146 | } |
147 | 147 |
@@ -41,5 +41,5 @@ |
||
41 | 41 | * @param $class |
42 | 42 | * @return mixed |
43 | 43 | */ |
44 | - public function addDispatcher($method,$class); |
|
44 | + public function addDispatcher($method, $class); |
|
45 | 45 | } |