@@ -89,12 +89,12 @@ discard block |
||
89 | 89 | */ |
90 | 90 | private function compileGroupData() |
91 | 91 | { |
92 | - if(!is_a($this->group, RouteGroups::class)) return null; |
|
92 | + if (!is_a($this->group, RouteGroups::class)) return null; |
|
93 | 93 | |
94 | 94 | $this->defaultName = $this->name = $this->group->name; |
95 | 95 | $this->defaultNamespace = $this->group->namespace; |
96 | 96 | |
97 | - if(is_a($this->group->middlewares, MiddlewareCollection::class)) { |
|
97 | + if (is_a($this->group->middlewares, MiddlewareCollection::class)) { |
|
98 | 98 | $this->middleware = $this->group->middlewares; |
99 | 99 | } |
100 | 100 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | preg_match_all("~\{\s*([a-zA-Z_][a-zA-Z0-9_-]*)\??\}~x", $route, $params, PREG_SET_ORDER); |
163 | 163 | |
164 | 164 | if ($wordOnly) { |
165 | - $params = array_map(function ($param) { |
|
165 | + $params = array_map(function($param) { |
|
166 | 166 | return $param[1]; |
167 | 167 | }, $params); |
168 | 168 | } |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | */ |
228 | 228 | private function resolveHandler(String $handler) |
229 | 229 | { |
230 | - if(!$this->defaultNamespace) { |
|
230 | + if (!$this->defaultNamespace) { |
|
231 | 231 | return $handler; |
232 | 232 | } |
233 | 233 | |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | */ |
330 | 330 | public function middleware($middleware): RouteManager |
331 | 331 | { |
332 | - if(is_a($this->middleware, MiddlewareCollection::class)) { |
|
332 | + if (is_a($this->middleware, MiddlewareCollection::class)) { |
|
333 | 333 | $middleware = $this->middleware->storeMiddleware($middleware); |
334 | 334 | } |
335 | 335 |
@@ -102,7 +102,7 @@ |
||
102 | 102 | |
103 | 103 | $methods = array_map("strtoupper", $methods); |
104 | 104 | |
105 | - array_map(function ($method) use ($uri, $callback) { |
|
105 | + array_map(function($method) use ($uri, $callback) { |
|
106 | 106 | $this->routes[$method][$uri] = $this->addRouter($uri, $callback); |
107 | 107 | }, $methods); |
108 | 108 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | protected function resolveNestedMiddleware(array $middlewares): void |
124 | 124 | { |
125 | - $this->queue = array_map(function ($middleware) { |
|
125 | + $this->queue = array_map(function($middleware) { |
|
126 | 126 | $middleware = trim(rtrim($middleware)); |
127 | 127 | |
128 | 128 | return $this->instanceMiddleware($middleware); |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | |
220 | 220 | return $currentMiddleware->handle( |
221 | 221 | $this->currentRequest, |
222 | - fn () => $this->next() |
|
222 | + fn() => $this->next() |
|
223 | 223 | ); |
224 | 224 | } |
225 | 225 | } |
@@ -139,7 +139,9 @@ |
||
139 | 139 | protected function instanceMiddleware($middleware) |
140 | 140 | { |
141 | 141 | if (!preg_match("/\\\/", $middleware)) { |
142 | - if (!$middlewareClass = $this->getByAlias($middleware)) return; |
|
142 | + if (!$middlewareClass = $this->getByAlias($middleware)) { |
|
143 | + return; |
|
144 | + } |
|
143 | 145 | |
144 | 146 | return new $middlewareClass(); |
145 | 147 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $this->httpMethod = $_SERVER['REQUEST_METHOD'] ?? ''; |
27 | 27 | $this->queryStrings = $_GET; |
28 | 28 | |
29 | - if(isset($this->queryStrings["route"])) { |
|
29 | + if (isset($this->queryStrings["route"])) { |
|
30 | 30 | unset($this->queryStrings["route"]); |
31 | 31 | } |
32 | 32 | |
@@ -98,15 +98,15 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function __get(String $data) |
100 | 100 | { |
101 | - if(isset($this->data[$data])) { |
|
101 | + if (isset($this->data[$data])) { |
|
102 | 102 | return $this->data[$data]; |
103 | 103 | } |
104 | 104 | |
105 | - if(isset($this->queryStrings[$data])) { |
|
105 | + if (isset($this->queryStrings[$data])) { |
|
106 | 106 | return $this->queryStrings[$data]; |
107 | 107 | } |
108 | 108 | |
109 | - if(isset($this->params[$data])) { |
|
109 | + if (isset($this->params[$data])) { |
|
110 | 110 | return $this->params[$data]; |
111 | 111 | } |
112 | 112 | |
@@ -142,11 +142,11 @@ discard block |
||
142 | 142 | } |
143 | 143 | } |
144 | 144 | |
145 | - if(empty($this->data)) { |
|
145 | + if (empty($this->data)) { |
|
146 | 146 | $this->data = []; |
147 | 147 | } |
148 | 148 | |
149 | - if(empty($this->params)) { |
|
149 | + if (empty($this->params)) { |
|
150 | 150 | $this->params = []; |
151 | 151 | } |
152 | 152 | } |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $allWithExcession = $this->data; |
216 | 216 | $except = explode(',', $except); |
217 | 217 | |
218 | - $except = array_map(function ($excession) { |
|
218 | + $except = array_map(function($excession) { |
|
219 | 219 | return trim(rtrim($excession)); |
220 | 220 | }, $except); |
221 | 221 |