@@ -123,7 +123,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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++; |