Passed
Push — master ( 1058d7...d2743c )
by Nícollas
01:36
created
src/Router/RouteManager.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -88,7 +88,9 @@  discard block
 block discarded – undo
88 88
      */
89 89
     private function compileGroupData()
90 90
     {
91
-        if(!is_a($this->group, RouteGroups::class)) return null;
91
+        if(!is_a($this->group, RouteGroups::class)) {
92
+            return null;
93
+        }
92 94
 
93 95
         $this->defaultName = $this->name = $this->group->name;
94 96
         $this->defaultNamespace = $this->group->namespace;
@@ -144,7 +146,9 @@  discard block
 block discarded – undo
144 146
      */
145 147
     protected function getWhere(String $param): ?String
146 148
     {
147
-        if (!isset($this->where[$param])) return null;
149
+        if (!isset($this->where[$param])) {
150
+            return null;
151
+        }
148 152
 
149 153
         return $this->where[$param];
150 154
     }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -89,12 +89,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Router/RouteCollection.php 2 patches
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -152,7 +152,9 @@  discard block
 block discarded – undo
152 152
             $routes = $this->routes[$httpMethod];
153 153
         }
154 154
 
155
-        if (!is_array($routes)) return null;
155
+        if (!is_array($routes)) {
156
+            return null;
157
+        }
156 158
 
157 159
         $soughtRoute = null;
158 160
 
@@ -323,7 +325,9 @@  discard block
 block discarded – undo
323 325
      */
324 326
     protected function getHttpCode(String $slug)
325 327
     {
326
-        if (!isset($this->httpCodes[$slug])) return null;
328
+        if (!isset($this->httpCodes[$slug])) {
329
+            return null;
330
+        }
327 331
 
328 332
         return $this->httpCodes[$slug];
329 333
     }
@@ -353,7 +357,9 @@  discard block
 block discarded – undo
353 357
     {
354 358
         $method = strtoupper($method);
355 359
 
356
-        if (!isset($this->routes[$method])) return null;
360
+        if (!isset($this->routes[$method])) {
361
+            return null;
362
+        }
357 363
 
358 364
         return $this->routes[$method];
359 365
     }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 
105 105
         $methods = array_map("strtoupper", $methods);
106 106
 
107
-        array_map(function ($method) use ($uri, $callback) {
107
+        array_map(function($method) use ($uri, $callback) {
108 108
             $this->routes[$method][$uri] = $this->addRouter($uri, $callback);
109 109
         }, $methods);
110 110
     }
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 
265 265
         $this->resolveRequestMethod();
266 266
 
267
-        if(!isset($this->routes[$this->requestMethod])) {
267
+        if (!isset($this->routes[$this->requestMethod])) {
268 268
             $this->throwException(
269 269
                 "badRequest",
270 270
                 BadMethodCallException::class,
Please login to merge, or discard this patch.
src/Http/Request.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -121,7 +121,9 @@  discard block
 block discarded – undo
121 121
 
122 122
         if (!empty($diff)) {
123 123
             foreach ($routeParams as $index => $param) {
124
-                if (!isset($diff[$index])) return;
124
+                if (!isset($diff[$index])) {
125
+                    return;
126
+                }
125 127
 
126 128
                 if ($this->httpMethod != 'GET') {
127 129
                     $this->params[$param] = rawurldecode($diff[$index]);
@@ -201,7 +203,9 @@  discard block
 block discarded – undo
201 203
         }, $except);
202 204
 
203 205
         foreach ($except as $excession) {
204
-            if (!isset($this->data[$excession])) return;
206
+            if (!isset($this->data[$excession])) {
207
+                return;
208
+            }
205 209
 
206 210
             unset($allWithExcession[$excession]);
207 211
         }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Router/Middlewares/MiddlewareCollection.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -139,7 +139,9 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
      */
145 145
     protected function resolveNestedMiddleware(Array $middlewares): void
146 146
     {
147
-        $this->queue = array_map(function ($middleware) {
147
+        $this->queue = array_map(function($middleware) {
148 148
             $middleware = trim(rtrim($middleware));
149 149
 
150 150
             return $this->instanceMiddleware($middleware);
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 
242 242
         return $currentMiddleware->handle(
243 243
             $this->currentRequest,
244
-            fn () => $this->next()
244
+            fn() => $this->next()
245 245
         );
246 246
     }
247 247
 }
Please login to merge, or discard this patch.
src/Traits/RouteManagerUtils.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
      */
14 14
     public function where(array $matches)
15 15
     {
16
-        array_map(function ($key, $value) {
16
+        array_map(function($key, $value) {
17 17
             $this->where[$key] = $value;
18 18
         }, array_keys($matches), $matches);
19 19
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public function name(String $name, Bool $ignoreDefault = false)
94 94
     {
95
-        if($ignoreDefault) {
95
+        if ($ignoreDefault) {
96 96
             $this->name = $name;
97 97
         } else {
98 98
             $this->name = $this->defaultName . $name;
Please login to merge, or discard this patch.