@@ -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 | private $dispatcher = [ |
26 | 26 | 'matchTemplate' => 'JetFire\Routing\Dispatcher\TemplateDispatcher', |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | /** |
39 | 39 | * @param string $matcher |
40 | 40 | */ |
41 | - public function addMatcher($matcher){ |
|
41 | + public function addMatcher($matcher) { |
|
42 | 42 | $this->matcher[] = $matcher; |
43 | 43 | } |
44 | 44 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function setDispatcher($dispatcher = []) |
57 | 57 | { |
58 | - $this->dispatcher = array_merge($dispatcher,$this->dispatcher); |
|
58 | + $this->dispatcher = array_merge($dispatcher, $this->dispatcher); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function match() |
65 | 65 | { |
66 | - foreach($this->matcher as $matcher){ |
|
67 | - if(call_user_func([$this,$matcher])) { |
|
66 | + foreach ($this->matcher as $matcher) { |
|
67 | + if (call_user_func([$this, $matcher])) { |
|
68 | 68 | $this->router->response->setStatusCode(202); |
69 | 69 | return true; |
70 | 70 | } |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | { |
80 | 80 | foreach ($this->router->getConfig()['viewExtension'] as $extension) { |
81 | 81 | for ($i = 0; $i < $this->router->collection->countRoutes; ++$i) { |
82 | - $url = explode('/', str_replace($this->router->collection->getRoutes('prefix_' . $i), '',$this->router->route->getUrl())); |
|
82 | + $url = explode('/', str_replace($this->router->collection->getRoutes('prefix_' . $i), '', $this->router->route->getUrl())); |
|
83 | 83 | $end = array_pop($url); |
84 | - $url = implode('/', array_map('ucwords', $url)).'/'.$end; |
|
84 | + $url = implode('/', array_map('ucwords', $url)) . '/' . $end; |
|
85 | 85 | if (is_file(($template = rtrim($this->router->collection->getRoutes('path_' . $i), '/') . $url . $extension))) { |
86 | 86 | $this->router->route->setTarget([ |
87 | 87 | 'dispatcher' => $this->dispatcher['matchTemplate'], |
@@ -104,11 +104,11 @@ discard block |
||
104 | 104 | { |
105 | 105 | $routes = array_slice(explode('/', $this->router->route->getUrl()), 1); |
106 | 106 | $i = 0; |
107 | - do{ |
|
108 | - $route = ('/' . $routes[0] == $this->router->collection->getRoutes('prefix_' . $i)) ? array_slice($routes, 1) : $routes; |
|
107 | + do { |
|
108 | + $route = ('/' . $routes[0] == $this->router->collection->getRoutes('prefix_' . $i)) ? array_slice($routes, 1) : $routes; |
|
109 | 109 | if (isset($route[0])) { |
110 | - $class = (class_exists($this->router->collection->getRoutes('namespace_' . $i). ucfirst($route[0]) . 'Controller')) |
|
111 | - ? $this->router->collection->getRoutes('namespace_' . $i). ucfirst($route[0]) . 'Controller' |
|
110 | + $class = (class_exists($this->router->collection->getRoutes('namespace_' . $i) . ucfirst($route[0]) . 'Controller')) |
|
111 | + ? $this->router->collection->getRoutes('namespace_' . $i) . ucfirst($route[0]) . 'Controller' |
|
112 | 112 | : ucfirst($route[0]) . 'Controller'; |
113 | 113 | if (isset($route[1]) && method_exists($class, $route[1])) { |
114 | 114 | $this->router->route->setTarget([ |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | } |
124 | 124 | } |
125 | 125 | ++$i; |
126 | - }while($i < $this->router->collection->countRoutes); |
|
126 | + }while ($i < $this->router->collection->countRoutes); |
|
127 | 127 | return false; |
128 | 128 | } |
129 | 129 |