Test Setup Failed
Push — master ( 903e2f...3c4145 )
by Mehmet
01:56
created
src/Router.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -138,6 +138,9 @@
 block discarded – undo
138 138
     }
139 139
 
140 140
 
141
+    /**
142
+     * @param string $requestMethods
143
+     */
141 144
     public function add(
142 145
         $requestMethods,
143 146
         string $route,
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\Router;
16 16
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
         }
116 116
         $this->method = $method;
117 117
         $this->requestedPath = $requestedPath;
118
-        $this->defaultReturnType = ($defaultReturnType >=1 && $defaultReturnType <=7) ? $defaultReturnType : self::HTML;
118
+        $this->defaultReturnType = ($defaultReturnType >= 1 && $defaultReturnType <= 7) ? $defaultReturnType : self::HTML;
119 119
     }
120 120
 
121 121
     public function withSubFolder(string $folder) : self
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
         if ($returnType === null) {
184 184
             return $this->defaultReturnType;
185 185
         }
186
-        return ($returnType >=1 && $returnType <=7) ? $returnType : self::HTML;
186
+        return ($returnType >= 1 && $returnType <= 7) ? $returnType : self::HTML;
187 187
     }
188 188
 
189 189
     private function checkRequestMethodIsValid(string $requestMethod) : void
Please login to merge, or discard this patch.
src/Route.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
     {
37 37
         if (count($uriParameters) > 0) {
38 38
             foreach ($uriParameters as $key => $value) {
39
-                $pattern = preg_replace('/{'.$key.'(.*?)}/msi', $value, $pattern);
39
+                $pattern = preg_replace('/{' . $key . '(.*?)}/msi', $value, $pattern);
40 40
             }
41 41
         }
42 42
         return $pattern;
Please login to merge, or discard this patch.
src/Dispatcher.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
     private static $dispatchResults = [
41 41
         FastRoute\Dispatcher::METHOD_NOT_ALLOWED => 405,
42
-        FastRoute\Dispatcher::FOUND => 200 ,
42
+        FastRoute\Dispatcher::FOUND => 200,
43 43
         FastRoute\Dispatcher::NOT_FOUND => 404
44 44
     ];
45 45
 
@@ -97,10 +97,10 @@  discard block
 block discarded – undo
97 97
      */
98 98
     private function addRoutes(FastRoute\RouteCollector $route) : void
99 99
     {
100
-        $routeIndex=0;
100
+        $routeIndex = 0;
101 101
         foreach ($this->routes as $definedRoute) {
102 102
             $definedRoute[3] = $definedRoute[3] ?? $this->defaultReturnType;
103
-            $routeName = 'routeClosure'.$routeIndex;
103
+            $routeName = 'routeClosure' . $routeIndex;
104 104
             $route->addRoute(strtoupper($definedRoute[0]), $definedRoute[1], $routeName);
105 105
             $routeIndex++;
106 106
         }
@@ -108,12 +108,12 @@  discard block
 block discarded – undo
108 108
 
109 109
     private function setRouteClosures() : void
110 110
     {
111
-        $routeIndex=0;
111
+        $routeIndex = 0;
112 112
         foreach ($this->routes as $definedRoute) {
113 113
             $definedRoute[3] = $definedRoute[3] ?? $this->defaultReturnType;
114
-            $routeName = 'routeClosure'.$routeIndex;
115
-            $this->routerClosures[$routeName]= function ($uriArguments) use ($definedRoute) {
116
-                $returnType = ($definedRoute[3] >=1 && $definedRoute[3] <=7) ? $definedRoute[3]
114
+            $routeName = 'routeClosure' . $routeIndex;
115
+            $this->routerClosures[$routeName] = function($uriArguments) use ($definedRoute) {
116
+                $returnType = ($definedRoute[3] >= 1 && $definedRoute[3] <= 7) ? $definedRoute[3]
117 117
                     : $this->defaultReturnType;
118 118
                 return  [
119 119
                     'status' => 200,
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
     {
139 139
         if ($routeInfo[0] === FastRoute\Dispatcher::FOUND) {
140 140
             [$dispatcher, $handler, $vars] = $routeInfo;
141
-            $routeParameters =  $this->routerClosures[$handler]($vars);
141
+            $routeParameters = $this->routerClosures[$handler]($vars);
142 142
             return new Route(
143 143
                 $routeParameters['requestMethod'],
144 144
                 $routeParameters['pattern'],
Please login to merge, or discard this patch.
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -43,6 +43,9 @@
 block discarded – undo
43 43
         FastRoute\Dispatcher::NOT_FOUND => 404
44 44
     ];
45 45
 
46
+    /**
47
+     * @param null|string $cachedFile
48
+     */
46 49
     public function __construct(array $routes, int $defaultReturnType, ?string  $cachedFile)
47 50
     {
48 51
         $this->routes = $routes;
Please login to merge, or discard this patch.