@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $this->response->setStatusCode(404); |
60 | 60 | $this->route = is_null($route) ? new Route() : $route; |
61 | 61 | $this->middleware = new Middleware($this); |
62 | - $this->config['di'] = function ($class) { |
|
62 | + $this->config['di'] = function($class) { |
|
63 | 63 | return new $class; |
64 | 64 | }; |
65 | 65 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | { |
117 | 117 | if (is_null($url)) |
118 | 118 | $url = (isset($_GET['url'])) ? $_GET['url'] : substr(str_replace(str_replace('/index.php', '', $_SERVER['SCRIPT_NAME']), '', $_SERVER['REQUEST_URI']), 1); |
119 | - $this->route->setUrl('/' . trim(explode('?', $url)[0], '/')); |
|
119 | + $this->route->setUrl('/'.trim(explode('?', $url)[0], '/')); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -170,10 +170,10 @@ discard block |
||
170 | 170 | } |
171 | 171 | $this->response->setStatusCode($code); |
172 | 172 | } |
173 | - if (isset($this->collection->middleware['before_render'])){ |
|
174 | - foreach ($this->collection->middleware['before_render'] as $callback){ |
|
173 | + if (isset($this->collection->middleware['before_render'])) { |
|
174 | + foreach ($this->collection->middleware['before_render'] as $callback) { |
|
175 | 175 | $call = explode('@', $callback); |
176 | - if(isset($call[1])){ |
|
176 | + if (isset($call[1])) { |
|
177 | 177 | $classes = ['JetFire\Routing\Router' => $this]; |
178 | 178 | $args = ['router' => $this, 'route' => $this->route, 'response' => $this->response]; |
179 | 179 | $this->callMethod($call[0], $call[1], $args, $args, $classes); |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | { |
222 | 222 | $reflector = new ReflectionClass($controller); |
223 | 223 | if (!$reflector->isInstantiable()) |
224 | - throw new \Exception('Controller [' . $controller . '] is not instantiable.'); |
|
224 | + throw new \Exception('Controller ['.$controller.'] is not instantiable.'); |
|
225 | 225 | $constructor = $reflector->getConstructor(); |
226 | 226 | if (is_null($constructor)) |
227 | 227 | return call_user_func_array($this->route->getTarget('di'), [$controller]); |