@@ -9,11 +9,11 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | public function getRequestIp(): string |
| 11 | 11 | { |
| 12 | - if (!empty($_SERVER['HTTP_CLIENT_IP'])) { |
|
| 12 | + if ( ! empty($_SERVER['HTTP_CLIENT_IP'])) { |
|
| 13 | 13 | $ip = $_SERVER['HTTP_CLIENT_IP']; |
| 14 | - } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR'] !== '127.0.0.1') { |
|
| 14 | + } elseif ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR'] !== '127.0.0.1') { |
|
| 15 | 15 | $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; |
| 16 | - } elseif (!empty($_SERVER['REMOTE_ADDR'])) { |
|
| 16 | + } elseif ( ! empty($_SERVER['REMOTE_ADDR'])) { |
|
| 17 | 17 | $ip = $_SERVER['REMOTE_ADDR']; |
| 18 | 18 | } else { |
| 19 | 19 | $ip = 'cli'; |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | protected function readAuthorizationToken(): ?string |
| 21 | 21 | { |
| 22 | 22 | $apiKey = $_COOKIE[$this->cookieName] ?? null; |
| 23 | - if (!$apiKey) { |
|
| 23 | + if ( ! $apiKey) { |
|
| 24 | 24 | $this->errorMessage = 'API key is not set'; |
| 25 | 25 | return null; |
| 26 | 26 | } |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | protected function readAuthorizationToken(): ?string |
| 30 | 30 | { |
| 31 | - if (!isset($_SERVER['HTTP_AUTHORIZATION'])) { |
|
| 31 | + if ( ! isset($_SERVER['HTTP_AUTHORIZATION'])) { |
|
| 32 | 32 | $this->errorMessage = 'Authorization header HTTP_Authorization is not set'; |
| 33 | 33 | return null; |
| 34 | 34 | } |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | { |
| 22 | 22 | $headerName = 'HTTP_' . strtoupper(str_replace('-', '_', $this->headerName)); |
| 23 | 23 | $apiKey = $_SERVER[$headerName] ?? null; |
| 24 | - if (!$apiKey) { |
|
| 24 | + if ( ! $apiKey) { |
|
| 25 | 25 | $this->errorMessage = 'API key is not set'; |
| 26 | 26 | return null; |
| 27 | 27 | } |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | protected function readAuthorizationToken(): ?string |
| 21 | 21 | { |
| 22 | 22 | $apiKey = $_GET[$this->queryParamName] ?? null; |
| 23 | - if (!$apiKey) { |
|
| 23 | + if ( ! $apiKey) { |
|
| 24 | 24 | $this->errorMessage = 'API key is not set'; |
| 25 | 25 | return null; |
| 26 | 26 | } |
@@ -10,11 +10,11 @@ |
||
| 10 | 10 | { |
| 11 | 11 | public function validateSchema(): bool |
| 12 | 12 | { |
| 13 | - return !Debugger::$productionMode; |
|
| 13 | + return ! Debugger::$productionMode; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | public function showErrorDetail(): bool |
| 17 | 17 | { |
| 18 | - return !Debugger::$productionMode; |
|
| 18 | + return ! Debugger::$productionMode; |
|
| 19 | 19 | } |
| 20 | 20 | } |
@@ -55,11 +55,11 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | private function getApiList(string $version): array |
| 57 | 57 | { |
| 58 | - $versionApis = array_filter($this->apiDecider->getApis(), function (Api $api) use ($version) { |
|
| 58 | + $versionApis = array_filter($this->apiDecider->getApis(), function(Api $api) use ($version) { |
|
| 59 | 59 | return $version === $api->getEndpoint()->getVersion(); |
| 60 | 60 | }); |
| 61 | 61 | |
| 62 | - return array_map(function (Api $api) { |
|
| 62 | + return array_map(function(Api $api) { |
|
| 63 | 63 | return [ |
| 64 | 64 | 'method' => $api->getEndpoint()->getMethod(), |
| 65 | 65 | 'version' => $api->getEndpoint()->getVersion(), |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | private function createParamsList(ApiHandlerInterface $handler): array |
| 83 | 83 | { |
| 84 | 84 | /** @phpstan-ignore-next-line */ |
| 85 | - return array_map(function (InputParam $param): array { |
|
| 85 | + return array_map(function(InputParam $param): array { |
|
| 86 | 86 | $parameter = [ |
| 87 | 87 | 'type' => $param->getType(), |
| 88 | 88 | 'key' => $param->getKey(), |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | } elseif ($param->getType() === InputParam::TYPE_COOKIE) { |
| 187 | 187 | $cookieFields[$key][] = $valueData; |
| 188 | 188 | } else { |
| 189 | - $getFields[$key][] = urlencode((string)$valueData); |
|
| 189 | + $getFields[$key][] = urlencode((string) $valueData); |
|
| 190 | 190 | } |
| 191 | 191 | } else { |
| 192 | 192 | if (in_array($param->getType(), [InputParam::TYPE_POST, InputParam::TYPE_FILE], true)) { |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | } elseif ($param->getType() === InputParam::TYPE_COOKIE) { |
| 197 | 197 | $cookieFields[$key] = $valueData; |
| 198 | 198 | } else { |
| 199 | - $getFields[$key] = urlencode((string)$valueData); |
|
| 199 | + $getFields[$key] = urlencode((string) $valueData); |
|
| 200 | 200 | } |
| 201 | 201 | } |
| 202 | 202 | } |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | { |
| 245 | 245 | $result = []; |
| 246 | 246 | foreach ($values as $key => $value) { |
| 247 | - if (!is_array($value)) { |
|
| 247 | + if ( ! is_array($value)) { |
|
| 248 | 248 | $result[$key] = $value; |
| 249 | 249 | continue; |
| 250 | 250 | } |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | public function __construct(string $status, array $errors = []) |
| 23 | 23 | { |
| 24 | - if (!in_array($status, [self::STATUS_OK, self::STATUS_ERROR], true)) { |
|
| 24 | + if ( ! in_array($status, [self::STATUS_OK, self::STATUS_ERROR], true)) { |
|
| 25 | 25 | throw new InvalidArgumentException($status . ' is not valid validation result status'); |
| 26 | 26 | } |
| 27 | 27 | |