@@ -40,7 +40,7 @@ |
||
| 40 | 40 | $versionHandlers = []; |
| 41 | 41 | foreach ($handlers as $handler) { |
| 42 | 42 | $endPoint = $handler->getEndpoint(); |
| 43 | - if (!isset($versionHandlers[$endPoint->getVersion()])) { |
|
| 43 | + if ( ! isset($versionHandlers[$endPoint->getVersion()])) { |
|
| 44 | 44 | $versionHandlers[$endPoint->getVersion()] = []; |
| 45 | 45 | } |
| 46 | 46 | $versionHandlers[$endPoint->getVersion()][] = $handler; |
@@ -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'; |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | |
| 26 | 26 | public function validate(ResponseInterface $response): ValidationResultInterface |
| 27 | 27 | { |
| 28 | - if (!$response instanceof JsonApiResponse) { |
|
| 28 | + if ( ! $response instanceof JsonApiResponse) { |
|
| 29 | 29 | return new ValidationResult(ValidationResult::STATUS_ERROR); |
| 30 | 30 | } |
| 31 | 31 | if ($this->code !== $response->getCode()) { |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | { |
| 12 | 12 | public function validate(ResponseInterface $response): ValidationResultInterface |
| 13 | 13 | { |
| 14 | - if (!$response instanceof RedirectResponse) { |
|
| 14 | + if ( ! $response instanceof RedirectResponse) { |
|
| 15 | 15 | return new ValidationResult(ValidationResult::STATUS_ERROR); |
| 16 | 16 | } |
| 17 | 17 | if ($this->code !== $response->getCode()) { |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | { |
| 30 | 30 | $urlScript = $this->httpRequest->getUrl(); |
| 31 | 31 | $authentication = $this->authentications[$urlScript->getUser()] ?? null; |
| 32 | - if (!$authentication) { |
|
| 32 | + if ( ! $authentication) { |
|
| 33 | 33 | return false; |
| 34 | 34 | } |
| 35 | 35 | return $authentication === $urlScript->getPassword(); |
@@ -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 | } |
@@ -12,11 +12,11 @@ |
||
| 12 | 12 | private const EXPECTED_HTTP_PARTS = 2; |
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | - * BearerTokenAuthorization constructor. |
|
| 16 | - * |
|
| 17 | - * @param TokenRepositoryInterface $tokenRepository |
|
| 18 | - * @param IpDetectorInterface $ipDetector |
|
| 19 | - */ |
|
| 15 | + * BearerTokenAuthorization constructor. |
|
| 16 | + * |
|
| 17 | + * @param TokenRepositoryInterface $tokenRepository |
|
| 18 | + * @param IpDetectorInterface $ipDetector |
|
| 19 | + */ |
|
| 20 | 20 | public function __construct(TokenRepositoryInterface $tokenRepository, IpDetectorInterface $ipDetector) |
| 21 | 21 | { |
| 22 | 22 | parent::__construct($tokenRepository, $ipDetector); |
@@ -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 | } |