@@ -49,21 +49,21 @@ discard block |
||
49 | 49 | $this->config()->set('api', false); |
50 | 50 | $this->config()->set('middlewares', []); |
51 | 51 | |
52 | - $this->handler('404', function (): array|string { |
|
52 | + $this->handler('404', function(): array | string { |
|
53 | 53 | if ($this->config()->get('api')) { |
54 | 54 | return ['status' => 404, 'msg' => '404 Not Found']; |
55 | 55 | } |
56 | 56 | |
57 | 57 | return '404 Not Found'; |
58 | 58 | }); |
59 | - $this->handler('405', function (): array|string { |
|
59 | + $this->handler('405', function(): array | string { |
|
60 | 60 | if ($this->config()->get('api')) { |
61 | 61 | return ['status' => 405, 'msg' => '405 Method Not Allowed']; |
62 | 62 | } |
63 | 63 | |
64 | 64 | return '405 Method Not Allowed'; |
65 | 65 | }); |
66 | - $this->handler('500', function (): array|string { |
|
66 | + $this->handler('500', function(): array | string { |
|
67 | 67 | if ($this->config()->get('api')) { |
68 | 68 | return ['status' => 500, 'msg' => '500 Internal Server Error']; |
69 | 69 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * Register a new handler in scrawler |
94 | 94 | * currently uselful hadlers are 404,405,500 and exception. |
95 | 95 | */ |
96 | - public function handler(string $name, \Closure|callable $callback): void |
|
96 | + public function handler(string $name, \Closure | callable $callback): void |
|
97 | 97 | { |
98 | 98 | //@codeCoverageIgnoreStart |
99 | 99 | $callback = \Closure::fromCallable(callback: $callback); |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | /** |
109 | 109 | * Get the handler by key. |
110 | 110 | */ |
111 | - public function getHandler(string $key): \Closure|callable |
|
111 | + public function getHandler(string $key): \Closure | callable |
|
112 | 112 | { |
113 | 113 | return $this->handler[$key]; |
114 | 114 | } |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | * |
207 | 207 | * @param array<string,mixed>|string|\Scrawler\Http\Response $content |
208 | 208 | */ |
209 | - private function makeResponse(array|string|Http\Response $content, int $status = 200): Http\Response |
|
209 | + private function makeResponse(array | string | Http\Response $content, int $status = 200): Http\Response |
|
210 | 210 | { |
211 | 211 | if (!$content instanceof Http\Response) { |
212 | 212 | $response = new Http\Response(); |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | * |
251 | 251 | * @param \Closure|callable|array<callable>|string $middlewares |
252 | 252 | */ |
253 | - public function middleware(\Closure|callable|array|string $middlewares): void |
|
253 | + public function middleware(\Closure | callable | array | string $middlewares): void |
|
254 | 254 | { |
255 | 255 | $this->config()->append('middlewares', $middlewares); |
256 | 256 | $middlewares = $this->pipeline()->validateMiddleware(middlewares: $this->config()->get('middlewares')); |