@@ -10,7 +10,7 @@ |
||
| 10 | 10 | |
| 11 | 11 | public function getValue(): mixed |
| 12 | 12 | { |
| 13 | - if (!filter_has_var(INPUT_POST, $this->key) && isset($_POST[$this->key])) { |
|
| 13 | + if ( ! filter_has_var(INPUT_POST, $this->key) && isset($_POST[$this->key])) { |
|
| 14 | 14 | return $_POST[$this->key]; |
| 15 | 15 | } |
| 16 | 16 | $value = $this->isMulti() ? filter_input(INPUT_POST, $this->key, FILTER_DEFAULT, FILTER_REQUIRE_ARRAY) : filter_input(INPUT_POST, $this->key); |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | |
| 11 | 11 | public function getValue(): mixed |
| 12 | 12 | { |
| 13 | - if (!filter_has_var(INPUT_COOKIE, $this->key) && isset($_COOKIE[$this->key])) { |
|
| 13 | + if ( ! filter_has_var(INPUT_COOKIE, $this->key) && isset($_COOKIE[$this->key])) { |
|
| 14 | 14 | return $_COOKIE[$this->key]; |
| 15 | 15 | } |
| 16 | 16 | $value = filter_input(INPUT_COOKIE, $this->key); |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $outputValid = count($outputs) === 0; // back compatibility for handlers with no outputs defined |
| 108 | 108 | $outputValidatorErrors = []; |
| 109 | 109 | foreach ($outputs as $output) { |
| 110 | - if (!$output instanceof OutputInterface) { |
|
| 110 | + if ( ! $output instanceof OutputInterface) { |
|
| 111 | 111 | $outputValidatorErrors[] = ['Output does not implement OutputInterface']; |
| 112 | 112 | continue; |
| 113 | 113 | } |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | } |
| 119 | 119 | $outputValidatorErrors[] = $validationResult->getErrors(); |
| 120 | 120 | } |
| 121 | - if (!$outputValid) { |
|
| 121 | + if ( ! $outputValid) { |
|
| 122 | 122 | $response = $this->errorHandler->handleSchema($outputValidatorErrors, $params); |
| 123 | 123 | $code = $response->getCode(); |
| 124 | 124 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | private function checkAuth(ApiAuthorizationInterface $authorization, array $params): ?IResponse |
| 158 | 158 | { |
| 159 | 159 | try { |
| 160 | - if (!$authorization->authorized()) { |
|
| 160 | + if ( ! $authorization->authorized()) { |
|
| 161 | 161 | $response = $this->errorHandler->handleAuthorization($authorization, $params); |
| 162 | 162 | $this->response->setCode($response->getCode()); |
| 163 | 163 | return $response; |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | private function checkRateLimit(RateLimitInterface $rateLimit): ?IResponse |
| 174 | 174 | { |
| 175 | 175 | $rateLimitResponse = $rateLimit->check(); |
| 176 | - if (!$rateLimitResponse) { |
|
| 176 | + if ( ! $rateLimitResponse) { |
|
| 177 | 177 | return null; |
| 178 | 178 | } |
| 179 | 179 | |
@@ -181,12 +181,12 @@ discard block |
||
| 181 | 181 | $remaining = $rateLimitResponse->getRemaining(); |
| 182 | 182 | $retryAfter = $rateLimitResponse->getRetryAfter(); |
| 183 | 183 | |
| 184 | - $this->response->addHeader('X-RateLimit-Limit', (string)$limit); |
|
| 185 | - $this->response->addHeader('X-RateLimit-Remaining', (string)$remaining); |
|
| 184 | + $this->response->addHeader('X-RateLimit-Limit', (string) $limit); |
|
| 185 | + $this->response->addHeader('X-RateLimit-Remaining', (string) $remaining); |
|
| 186 | 186 | |
| 187 | 187 | if ($remaining === 0) { |
| 188 | 188 | $this->response->setCode(Response::S429_TOO_MANY_REQUESTS); |
| 189 | - $this->response->addHeader('Retry-After', (string)$retryAfter); |
|
| 189 | + $this->response->addHeader('Retry-After', (string) $retryAfter); |
|
| 190 | 190 | return $rateLimitResponse->getErrorResponse() ?: new JsonResponse(['status' => 'error', 'message' => 'Too many requests. Retry after ' . $retryAfter . ' seconds.']); |
| 191 | 191 | } |
| 192 | 192 | return null; |
@@ -248,11 +248,11 @@ discard block |
||
| 248 | 248 | |
| 249 | 249 | private function getRequestDomain(): ?string |
| 250 | 250 | { |
| 251 | - if (!filter_input(INPUT_SERVER, 'HTTP_REFERER')) { |
|
| 251 | + if ( ! filter_input(INPUT_SERVER, 'HTTP_REFERER')) { |
|
| 252 | 252 | return null; |
| 253 | 253 | } |
| 254 | 254 | $refererParsedUrl = parse_url(filter_input(INPUT_SERVER, 'HTTP_REFERER')); |
| 255 | - if (!(isset($refererParsedUrl['scheme']) && isset($refererParsedUrl['host']))) { |
|
| 255 | + if ( ! (isset($refererParsedUrl['scheme']) && isset($refererParsedUrl['host']))) { |
|
| 256 | 256 | return null; |
| 257 | 257 | } |
| 258 | 258 | $url = $refererParsedUrl['scheme'] . '://' . $refererParsedUrl['host']; |
@@ -127,7 +127,7 @@ |
||
| 127 | 127 | /** |
| 128 | 128 | * @param mixed[] $values |
| 129 | 129 | * @return mixed[] |
| 130 | - */ |
|
| 130 | + */ |
|
| 131 | 131 | private function filterFormValues(array $values): array |
| 132 | 132 | { |
| 133 | 133 | foreach ($this->handler->params() as $param) { |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | return $this->code; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - public function getExpiration(): DateTimeInterface|false|null |
|
| 47 | + public function getExpiration(): DateTimeInterface | false | null |
|
| 48 | 48 | { |
| 49 | 49 | return $this->expiration; |
| 50 | 50 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | /** |
| 55 | 55 | * @return array<mixed>|JsonSerializable |
| 56 | 56 | */ |
| 57 | - public function getPayload(): array|JsonSerializable |
|
| 57 | + public function getPayload(): array | JsonSerializable |
|
| 58 | 58 | { |
| 59 | 59 | return $this->payload; |
| 60 | 60 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | return $this->charset; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - public function getExpiration(): DateTimeInterface|false|null |
|
| 72 | + public function getExpiration(): DateTimeInterface | false | null |
|
| 73 | 73 | { |
| 74 | 74 | return $this->expiration; |
| 75 | 75 | } |