Completed
Push — master ( 469584...3034b4 )
by Mehmet
08:04
created
src/Router.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -160,6 +160,7 @@
 block discarded – undo
160 160
      * @param  string                      $action
161 161
      * @param  int                         $returnType
162 162
      * @param  string                      $alias
163
+     * @param string $requestMethods
163 164
      * @throws InvalidArgumentException
164 165
      * @throws UnexpectedValueException
165 166
      */
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,6 @@
 block discarded – undo
14 14
 
15 15
 namespace Selami;
16 16
 
17
-use FastRoute;
18 17
 use InvalidArgumentException;
19 18
 use UnexpectedValueException;
20 19
 use RuntimeException;
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @link     https://github.com/selamiphp/router
11 11
  */
12 12
 
13
-declare(strict_types = 1);
13
+declare(strict_types=1);
14 14
 
15 15
 namespace Selami;
16 16
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         }
127 127
         $this->method = $method;
128 128
         $this->requestedPath = $this->extractFolder($requestedPath, $folder);
129
-        $this->defaultReturnType = ($defaultReturnType >=1 && $defaultReturnType <=7) ? $defaultReturnType : self::HTML;
129
+        $this->defaultReturnType = ($defaultReturnType >= 1 && $defaultReturnType <= 7) ? $defaultReturnType : self::HTML;
130 130
         $this->cachedFile = $cachedFile;
131 131
     }
132 132
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
         if ($returnType === null) {
208 208
             return $this->defaultReturnType;
209 209
         }
210
-        return ($returnType >=1 && $returnType <=7) ? $returnType : self::HTML;
210
+        return ($returnType >= 1 && $returnType <= 7) ? $returnType : self::HTML;
211 211
     }
212 212
 
213 213
     /**
Please login to merge, or discard this patch.
src/Dispatcher.php 2 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -38,6 +38,9 @@  discard block
 block discarded – undo
38 38
     private $routerClosures = [];
39 39
 
40 40
 
41
+    /**
42
+     * @param null|string $cachedFile
43
+     */
41 44
     public function __construct(array $routes, int $defaultReturnType, ?string  $cachedFile)
42 45
     {
43 46
         $this->routes = $routes;
@@ -69,6 +72,9 @@  discard block
 block discarded – undo
69 72
         return new FastRoute\Dispatcher\GroupCountBased($routeCollector->getData());
70 73
     }
71 74
 
75
+    /**
76
+     * @param FastRoute\RouteCollector $routeCollector
77
+     */
72 78
     private function createCachedRoute($routeCollector) : void
73 79
     {
74 80
         if ($this->cachedFile !== null && !file_exists($this->cachedFile)) {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
      */
101 101
     private function addRoutes(FastRoute\RouteCollector $route) : void
102 102
     {
103
-        $routeIndex=0;
103
+        $routeIndex = 0;
104 104
         foreach ($this->routes as $definedRoute) {
105 105
             $definedRoute[3] = $definedRoute[3] ?? $this->defaultReturnType;
106
-            $routeName = 'routeClosure'.$routeIndex;
106
+            $routeName = 'routeClosure' . $routeIndex;
107 107
             $route->addRoute(strtoupper($definedRoute[0]), $definedRoute[1], $routeName);
108 108
             $routeIndex++;
109 109
         }
@@ -111,13 +111,13 @@  discard block
 block discarded – undo
111 111
 
112 112
     private function setRouteClosures() : void
113 113
     {
114
-        $routeIndex=0;
114
+        $routeIndex = 0;
115 115
         foreach ($this->routes as $definedRoute) {
116 116
             $definedRoute[3] = $definedRoute[3] ?? $this->defaultReturnType;
117
-            $routeName = 'routeClosure'.$routeIndex;
117
+            $routeName = 'routeClosure' . $routeIndex;
118 118
             [$requestMedhod, $url, $controller, $returnType] = $definedRoute;
119
-            $returnType = ($returnType >=1 && $returnType <=7) ? $returnType : $this->defaultReturnType;
120
-            $this->routerClosures[$routeName]= function ($args) use ($controller, $returnType) {
119
+            $returnType = ($returnType >= 1 && $returnType <= 7) ? $returnType : $this->defaultReturnType;
120
+            $this->routerClosures[$routeName] = function($args) use ($controller, $returnType) {
121 121
                 return  ['controller' => $controller, 'returnType'=> $returnType, 'args'=> $args];
122 122
             };
123 123
             $routeIndex++;
Please login to merge, or discard this patch.