@@ -50,7 +50,7 @@ |
||
50 | 50 | /** |
51 | 51 | * Transform data using Fractal |
52 | 52 | */ |
53 | - protected function transform(Item|Collection $resource): array |
|
53 | + protected function transform(Item | Collection $resource): array |
|
54 | 54 | { |
55 | 55 | return $this->fractal->createData($resource)->toArray(); |
56 | 56 | } |
@@ -91,12 +91,12 @@ |
||
91 | 91 | $errors = []; |
92 | 92 | |
93 | 93 | // Check if any endpoints are invalid |
94 | - if (array_any($endpoints, static fn($endpoint) => !$endpoint instanceof \Tomaj\NetteApi\EndpointInterface)) { |
|
94 | + if (array_any($endpoints, static fn($endpoint) => ! $endpoint instanceof \Tomaj\NetteApi\EndpointInterface)) { |
|
95 | 95 | $errors[] = 'Some endpoints do not implement EndpointInterface'; |
96 | 96 | } |
97 | 97 | |
98 | 98 | // Check if all endpoints have valid methods |
99 | - if (!array_all($endpoints, static fn($endpoint) => in_array($endpoint->getMethod(), ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'], true))) { |
|
99 | + if ( ! array_all($endpoints, static fn($endpoint) => in_array($endpoint->getMethod(), ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'], true))) { |
|
100 | 100 | $errors[] = 'Some endpoints have invalid HTTP methods'; |
101 | 101 | } |
102 | 102 |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | |
26 | 26 | public function __construct( |
27 | 27 | public readonly int $code, |
28 | - public readonly array|JsonSerializable $payload, |
|
28 | + public readonly array | JsonSerializable $payload, |
|
29 | 29 | string $contentType = 'application/json', |
30 | 30 | public readonly string $charset = 'utf-8', |
31 | - public readonly DateTimeInterface|null|false $expiration = null |
|
31 | + public readonly DateTimeInterface | null | false $expiration = null |
|
32 | 32 | ) { |
33 | 33 | $this->contentType = $contentType; |
34 | 34 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | return $this->code; |
39 | 39 | } |
40 | 40 | |
41 | - public function getPayload(): array|JsonSerializable |
|
41 | + public function getPayload(): array | JsonSerializable |
|
42 | 42 | { |
43 | 43 | return $this->payload; |
44 | 44 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | public function __construct( |
19 | 19 | public readonly EndpointInterface $endpoint, |
20 | - public readonly ApiHandlerInterface|string $handler, |
|
20 | + public readonly ApiHandlerInterface | string $handler, |
|
21 | 21 | public readonly ApiAuthorizationInterface $authorization, |
22 | 22 | ?RateLimitInterface $rateLimit = null |
23 | 23 | ) { |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | return $this->endpoint; |
30 | 30 | } |
31 | 31 | |
32 | - public function getHandler(): ApiHandlerInterface|string |
|
32 | + public function getHandler(): ApiHandlerInterface | string |
|
33 | 33 | { |
34 | 34 | return $this->handler; |
35 | 35 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | */ |
29 | 29 | public function __construct( |
30 | 30 | string $method, |
31 | - string|int $version, |
|
31 | + string | int $version, |
|
32 | 32 | public readonly string $package, |
33 | 33 | public readonly ?string $apiAction = null |
34 | 34 | ) { |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function addApi( |
88 | 88 | EndpointInterface $endpointIdentifier, |
89 | - ApiHandlerInterface|string $handler, |
|
89 | + ApiHandlerInterface | string $handler, |
|
90 | 90 | ApiAuthorizationInterface $apiAuthorization, |
91 | 91 | ?RateLimitInterface $rateLimit = null |
92 | 92 | ): self { |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $handler = $this->container->getByType($handler); |
159 | 159 | } |
160 | 160 | |
161 | - if (!$handler instanceof ApiHandlerInterface) { |
|
161 | + if ( ! $handler instanceof ApiHandlerInterface) { |
|
162 | 162 | throw new \InvalidArgumentException('Handler must implement ApiHandlerInterface'); |
163 | 163 | } |
164 | 164 |