|
@@ -127,7 +127,7 @@ discard block |
|
|
block discarded – undo |
|
127
|
127
|
$message = sprintf('%s is not valid Http request method.', $method); |
|
128
|
128
|
throw new UnexpectedValueException($message); |
|
129
|
129
|
} |
|
130
|
|
- $this->method = $method; |
|
|
130
|
+ $this->method = $method; |
|
131
|
131
|
$this->requestedPath = $this->extractFolder($requestedPath, $folder); |
|
132
|
132
|
$this->defaultReturnType = self::$translations[$defaultReturnType] ?? self::$validReturnTypes[0]; |
|
133
|
133
|
} |
|
@@ -159,7 +159,7 @@ discard block |
|
|
block discarded – undo |
|
159
|
159
|
* @throws InvalidArgumentException |
|
160
|
160
|
* @throws UnexpectedValueException |
|
161
|
161
|
*/ |
|
162
|
|
- public function add($requestMethods, string $route, string $action, ?string $returnType = null, ?string $alias = null) |
|
|
162
|
+ public function add($requestMethods, string $route, string $action, ? string $returnType = null, ? string $alias = null) |
|
163
|
163
|
{ |
|
164
|
164
|
$requestMethodsGiven = is_array($requestMethods) ? (array) $requestMethods : [0 => $requestMethods]; |
|
165
|
165
|
$returnType = $this->determineReturnType($returnType); |
|
@@ -197,7 +197,7 @@ discard block |
|
|
block discarded – undo |
|
197
|
197
|
* @param string|null $returnType |
|
198
|
198
|
* @return string |
|
199
|
199
|
*/ |
|
200
|
|
- private function determineReturnType(?string $returnType) : string |
|
|
200
|
+ private function determineReturnType(? string $returnType) : string |
|
201
|
201
|
{ |
|
202
|
202
|
if ($returnType === null) { |
|
203
|
203
|
return $this->defaultReturnType; |
|
@@ -262,7 +262,7 @@ discard block |
|
|
block discarded – undo |
|
262
|
262
|
{ |
|
263
|
263
|
foreach ($this->routes as $definedRoute) { |
|
264
|
264
|
$definedRoute[3] = $definedRoute[3] ?? $this->defaultReturnType; |
|
265
|
|
- $route->addRoute(strtoupper($definedRoute[0]), $definedRoute[1], function ($args) use ($definedRoute) { |
|
|
265
|
+ $route->addRoute(strtoupper($definedRoute[0]), $definedRoute[1], function($args) use ($definedRoute) { |
|
266
|
266
|
[$null1, $null2, $controller, $returnType] = $definedRoute; |
|
267
|
267
|
$returnType = Router::$translations[$returnType] ?? $this->defaultReturnType; |
|
268
|
268
|
return ['controller' => $controller, 'returnType'=> $returnType, 'args'=> $args]; |