@@ -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 | $callback = \Closure::fromCallable(callback: $callback); |
99 | 99 | if ('exception' === $name) { |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | /** |
107 | 107 | * Get the handler by key. |
108 | 108 | */ |
109 | - public function getHandler(string $key): \Closure|callable |
|
109 | + public function getHandler(string $key): \Closure | callable |
|
110 | 110 | { |
111 | 111 | return $this->handler[$key]; |
112 | 112 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * |
205 | 205 | * @param array<string,mixed>|string|\Scrawler\Http\Response $content |
206 | 206 | */ |
207 | - private function makeResponse(array|string|Http\Response $content, int $status = 200): Http\Response |
|
207 | + private function makeResponse(array | string | Http\Response $content, int $status = 200): Http\Response |
|
208 | 208 | { |
209 | 209 | if (!$content instanceof Http\Response) { |
210 | 210 | $response = new Http\Response(); |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | * |
249 | 249 | * @param \Closure|callable|array<callable>|string $middlewares |
250 | 250 | */ |
251 | - public function middleware(\Closure|callable|array|string $middlewares): void |
|
251 | + public function middleware(\Closure | callable | array | string $middlewares): void |
|
252 | 252 | { |
253 | 253 | $this->config()->append('middlewares', $middlewares); |
254 | 254 | $middlewares = $this->pipeline()->validateMiddleware(middlewares: $this->config()->get('middlewares')); |
@@ -59,7 +59,7 @@ |
||
59 | 59 | * |
60 | 60 | * @param array<mixed> $params |
61 | 61 | */ |
62 | - public function call(string|callable $class, array $params = []): mixed |
|
62 | + public function call(string | callable $class, array $params = []): mixed |
|
63 | 63 | { |
64 | 64 | return $this->container->call($class, $params); |
65 | 65 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | /** |
24 | 24 | * Register a new get route with the router. |
25 | 25 | */ |
26 | - public function get(string $route, \Closure|callable $callback): void |
|
26 | + public function get(string $route, \Closure | callable $callback): void |
|
27 | 27 | { |
28 | 28 | $callback = \Closure::fromCallable(callback: $callback); |
29 | 29 | $this->router->get($route, $callback); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | /** |
33 | 33 | * Register a new post route with the router. |
34 | 34 | */ |
35 | - public function post(string $route, \Closure|callable $callback): void |
|
35 | + public function post(string $route, \Closure | callable $callback): void |
|
36 | 36 | { |
37 | 37 | $callback = \Closure::fromCallable(callback: $callback); |
38 | 38 | $this->router->post($route, $callback); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | /** |
42 | 42 | * Register a new put route with the router. |
43 | 43 | */ |
44 | - public function put(string $route, \Closure|callable $callback): void |
|
44 | + public function put(string $route, \Closure | callable $callback): void |
|
45 | 45 | { |
46 | 46 | $callback = \Closure::fromCallable(callback: $callback); |
47 | 47 | $this->router->put($route, $callback); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | /** |
51 | 51 | * Register a new delete route with the router. |
52 | 52 | */ |
53 | - public function delete(string $route, \Closure|callable $callback): void |
|
53 | + public function delete(string $route, \Closure | callable $callback): void |
|
54 | 54 | { |
55 | 55 | $callback = \Closure::fromCallable(callback: $callback); |
56 | 56 | $this->router->delete($route, $callback); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | /** |
60 | 60 | * Register a new all route with the router. |
61 | 61 | */ |
62 | - public function all(string $route, \Closure|callable $callback): void |
|
62 | + public function all(string $route, \Closure | callable $callback): void |
|
63 | 63 | { |
64 | 64 | $callback = \Closure::fromCallable(callback: $callback); |
65 | 65 | $this->router->all($route, $callback); |