Passed
Push — master ( 63879d...fd8988 )
by Mehmet
01:44
created
src/Router.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -161,6 +161,7 @@  discard block
 block discarded – undo
161 161
      * @param  string                      $action
162 162
      * @param  int                         $returnType
163 163
      * @param  string                      $alias
164
+     * @param string $requestMethods
164 165
      * @throws InvalidArgumentException
165 166
      * @throws UnexpectedValueException
166 167
      */
@@ -268,6 +269,9 @@  discard block
 block discarded – undo
268 269
         return new FastRoute\Dispatcher\GroupCountBased($routeCollector->getData());
269 270
     }
270 271
 
272
+    /**
273
+     * @param FastRoute\RouteCollector $routeCollector
274
+     */
271 275
     private function createCachedRoute($routeCollector) : void
272 276
     {
273 277
         if ($this->cachedFile !== null && !file_exists($this->cachedFile)) {
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         string $method,
124 124
         string $requestedPath,
125 125
         string $folder = '',
126
-        ?string $cachedFile = null
126
+        ? string $cachedFile = null
127 127
     ) {
128 128
         if (!in_array($method, self::$validRequestMethods, true)) {
129 129
             $message = sprintf('%s is not valid Http request method.', $method);
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
         }
132 132
         $this->method = $method;
133 133
         $this->requestedPath = $this->extractFolder($requestedPath, $folder);
134
-        $this->defaultReturnType = ($defaultReturnType >=1 && $defaultReturnType <=7) ? $defaultReturnType : self::HTML;
134
+        $this->defaultReturnType = ($defaultReturnType >= 1 && $defaultReturnType <= 7) ? $defaultReturnType : self::HTML;
135 135
         $this->cachedFile = $cachedFile;
136 136
     }
137 137
 
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
         $requestMethods,
169 169
         string $route,
170 170
         string $action,
171
-        ?int $returnType = null,
172
-        ?string $alias = null
171
+        ? int $returnType = null,
172
+        ? string $alias = null
173 173
     ) : void {
174 174
     
175 175
         $requestMethodsGiven = is_array($requestMethods) ? (array) $requestMethods : [0 => $requestMethods];
@@ -207,12 +207,12 @@  discard block
 block discarded – undo
207 207
      * @param int|null $returnType
208 208
      * @return int
209 209
      */
210
-    private function determineReturnType(?int $returnType) : int
210
+    private function determineReturnType(? int $returnType) : int
211 211
     {
212 212
         if ($returnType === null) {
213 213
             return $this->defaultReturnType;
214 214
         }
215
-        return ($returnType >=1 && $returnType <=7) ? $returnType : self::HTML;
215
+        return ($returnType >= 1 && $returnType <= 7) ? $returnType : self::HTML;
216 216
     }
217 217
 
218 218
     /**
@@ -299,23 +299,23 @@  discard block
 block discarded – undo
299 299
      */
300 300
     private function addRoutes(FastRoute\RouteCollector $route) : void
301 301
     {
302
-        $routeIndex=0;
302
+        $routeIndex = 0;
303 303
         foreach ($this->routes as $definedRoute) {
304 304
             $definedRoute[3] = $definedRoute[3] ?? $this->defaultReturnType;
305
-            $routeName = 'routeClosure'.$routeIndex;
305
+            $routeName = 'routeClosure' . $routeIndex;
306 306
             $route->addRoute(strtoupper($definedRoute[0]), $definedRoute[1], $routeName);
307 307
             $routeIndex++;
308 308
         }
309 309
     }
310 310
     private function setRouteClosures() : void
311 311
     {
312
-        $routeIndex=0;
312
+        $routeIndex = 0;
313 313
         foreach ($this->routes as $definedRoute) {
314 314
             $definedRoute[3] = $definedRoute[3] ?? $this->defaultReturnType;
315
-            $routeName = 'routeClosure'.$routeIndex;
315
+            $routeName = 'routeClosure' . $routeIndex;
316 316
             [$requestMedhod, $url, $controller, $returnType] = $definedRoute;
317
-            $returnType = ($returnType >=1 && $returnType <=7) ? $returnType : $this->defaultReturnType;
318
-            $this->routerClosures[$routeName]= function ($args) use ($controller, $returnType) {
317
+            $returnType = ($returnType >= 1 && $returnType <= 7) ? $returnType : $this->defaultReturnType;
318
+            $this->routerClosures[$routeName] = function($args) use ($controller, $returnType) {
319 319
                 return  ['controller' => $controller, 'returnType'=> $returnType, 'args'=> $args];
320 320
             };
321 321
             $routeIndex++;
Please login to merge, or discard this patch.