|
@@ -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 = $returnType === null ? $this->defaultReturnType : self::$validReturnTypes[$returnType] ?? $this->defaultReturnType; |
|
@@ -231,8 +231,8 @@ discard block |
|
|
block discarded – undo |
|
231
|
231
|
{ |
|
232
|
232
|
foreach ($this->routes as $definedRoute) { |
|
233
|
233
|
$definedRoute[3] = $definedRoute[3] ?? $this->defaultReturnType; |
|
234
|
|
- $route->addRoute(strtoupper($definedRoute[0]), $definedRoute[1], function ($args) use ($definedRoute) { |
|
235
|
|
- list(,,$controller, $returnType) = $definedRoute; |
|
|
234
|
+ $route->addRoute(strtoupper($definedRoute[0]), $definedRoute[1], function($args) use ($definedRoute) { |
|
|
235
|
+ list(,, $controller, $returnType) = $definedRoute; |
|
236
|
236
|
$returnType = Router::$translations[$returnType] ?? $this->defaultReturnType; |
|
237
|
237
|
return ['controller' => $controller, 'returnType'=> $returnType, 'args'=> $args]; |
|
238
|
238
|
}); |