@@ -16,7 +16,7 @@ |
||
| 16 | 16 | |
| 17 | 17 | public function __construct(string $status, array $errors = []) |
| 18 | 18 | { |
| 19 | - if (!in_array($status, [self::STATUS_OK, self::STATUS_ERROR], true)) { |
|
| 19 | + if ( ! in_array($status, [self::STATUS_OK, self::STATUS_ERROR], true)) { |
|
| 20 | 20 | throw new InvalidArgumentException($status . ' is not valid validation result status'); |
| 21 | 21 | } |
| 22 | 22 | |
@@ -21,11 +21,11 @@ |
||
| 21 | 21 | { |
| 22 | 22 | foreach ($this->params as $param) { |
| 23 | 23 | $validationResult = $param->validate(); |
| 24 | - if (!$validationResult->isOk()) { |
|
| 24 | + if ( ! $validationResult->isOk()) { |
|
| 25 | 25 | $this->errors[$param->getKey()] = $validationResult->getErrors(); |
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | - return !empty($this->errors); |
|
| 28 | + return ! empty($this->errors); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | public function getErrors(): array |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | return new ValidationResult(ValidationResult::STATUS_ERROR, [json_last_error_msg()]); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - if (!$value && $this->isRequired() === self::OPTIONAL) { |
|
| 43 | + if ( ! $value && $this->isRequired() === self::OPTIONAL) { |
|
| 44 | 44 | return new ValidationResult(ValidationResult::STATUS_OK); |
| 45 | 45 | } |
| 46 | 46 | |
@@ -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()) { |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | } |
| 89 | 89 | $outputValidatorErrors[] = $validationResult->getErrors(); |
| 90 | 90 | } |
| 91 | - if (!$outputValid) { |
|
| 91 | + if ( ! $outputValid) { |
|
| 92 | 92 | $response = new JsonApiResponse(500, ['status' => 'error', 'message' => 'Internal server error', 'details' => $outputValidatorErrors]); |
| 93 | 93 | } |
| 94 | 94 | $code = $response->getCode(); |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | private function checkAuth(ApiAuthorizationInterface $authorization): bool |
| 129 | 129 | { |
| 130 | - if (!$authorization->authorized()) { |
|
| 130 | + if ( ! $authorization->authorized()) { |
|
| 131 | 131 | $this->getHttpResponse()->setCode(Response::S403_FORBIDDEN); |
| 132 | 132 | $this->sendResponse(new JsonResponse(['status' => 'error', 'message' => $authorization->getErrorMessage()])); |
| 133 | 133 | return false; |
@@ -207,11 +207,11 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | private function getRequestDomain(): ?string |
| 209 | 209 | { |
| 210 | - if (!filter_input(INPUT_SERVER, 'HTTP_REFERER')) { |
|
| 210 | + if ( ! filter_input(INPUT_SERVER, 'HTTP_REFERER')) { |
|
| 211 | 211 | return null; |
| 212 | 212 | } |
| 213 | 213 | $refererParsedUrl = parse_url(filter_input(INPUT_SERVER, 'HTTP_REFERER')); |
| 214 | - if (!(isset($refererParsedUrl['scheme']) && isset($refererParsedUrl['host']))) { |
|
| 214 | + if ( ! (isset($refererParsedUrl['scheme']) && isset($refererParsedUrl['host']))) { |
|
| 215 | 215 | return null; |
| 216 | 216 | } |
| 217 | 217 | $url = $refererParsedUrl['scheme'] . '://' . $refererParsedUrl['host']; |
@@ -205,7 +205,7 @@ |
||
| 205 | 205 | { |
| 206 | 206 | $result = []; |
| 207 | 207 | foreach ($values as $key => $value) { |
| 208 | - if (!is_array($value)) { |
|
| 208 | + if ( ! is_array($value)) { |
|
| 209 | 209 | $result[$key] = $value; |
| 210 | 210 | continue; |
| 211 | 211 | } |