@@ -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 | } |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | |
| 10 | 10 | class BearerTokenAuthorization extends TokenAuthorization |
| 11 | 11 | { |
| 12 | - /** |
|
| 12 | + /** |
|
| 13 | 13 | * BearerTokenAuthorization constructor. |
| 14 | 14 | * |
| 15 | 15 | * @param TokenRepositoryInterface $tokenRepository |
@@ -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 | } |
@@ -46,12 +46,12 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | $result = $this->tokenRepository->validToken($token); |
| 49 | - if (!$result) { |
|
| 49 | + if ( ! $result) { |
|
| 50 | 50 | $this->errorMessage = 'Token doesn\'t exists or isn\'t active'; |
| 51 | 51 | return false; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - if (!$this->isValidIp($this->tokenRepository->ipRestrictions($token))) { |
|
| 54 | + if ( ! $this->isValidIp($this->tokenRepository->ipRestrictions($token))) { |
|
| 55 | 55 | $this->errorMessage = 'Invalid IP'; |
| 56 | 56 | return false; |
| 57 | 57 | } |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | list($range, $netmask) = explode('/', $range, 2); |
| 115 | 115 | $range_decimal = ip2long($range); |
| 116 | 116 | $ipDecimal = ip2long($ip); |
| 117 | - $wildcard_decimal = pow(2, (32 - (int)$netmask)) - 1; |
|
| 117 | + $wildcard_decimal = pow(2, (32 - (int) $netmask)) - 1; |
|
| 118 | 118 | $netmask_decimal = ~ $wildcard_decimal; |
| 119 | 119 | return (($ipDecimal & $netmask_decimal) === ($range_decimal & $netmask_decimal)); |
| 120 | 120 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | } elseif ($param->getType() === InputParam::TYPE_COOKIE) { |
| 170 | 170 | $cookieFields[$key][] = $valueData; |
| 171 | 171 | } else { |
| 172 | - $getFields[$key][] = urlencode((string)$valueData); |
|
| 172 | + $getFields[$key][] = urlencode((string) $valueData); |
|
| 173 | 173 | } |
| 174 | 174 | } else { |
| 175 | 175 | if (in_array($param->getType(), [InputParam::TYPE_POST, InputParam::TYPE_FILE])) { |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | } elseif ($param->getType() === InputParam::TYPE_COOKIE) { |
| 180 | 180 | $cookieFields[$key] = $valueData; |
| 181 | 181 | } else { |
| 182 | - $getFields[$key] = urlencode((string)$valueData); |
|
| 182 | + $getFields[$key] = urlencode((string) $valueData); |
|
| 183 | 183 | } |
| 184 | 184 | } |
| 185 | 185 | } |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | { |
| 224 | 224 | $result = []; |
| 225 | 225 | foreach ($values as $key => $value) { |
| 226 | - if (!is_array($value)) { |
|
| 226 | + if ( ! is_array($value)) { |
|
| 227 | 227 | $result[$key] = $value; |
| 228 | 228 | continue; |
| 229 | 229 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | if (count($args) < 3) { |
| 31 | 31 | $message = "Invalid link destination, too few arguments."; |
| 32 | - if (!Debugger::$productionMode) { |
|
| 32 | + if ( ! Debugger::$productionMode) { |
|
| 33 | 33 | throw new InvalidLinkException($message); |
| 34 | 34 | } |
| 35 | 35 | Debugger::log($message, Debugger::EXCEPTION); |
@@ -45,8 +45,8 @@ discard block |
||
| 45 | 45 | ]; |
| 46 | 46 | |
| 47 | 47 | return $writer->write('echo ($this->filters->apiLink)((new Tomaj\NetteApi\EndpointIdentifier(' . |
| 48 | - $arguments['method'] . ', ' . |
|
| 49 | - $arguments['version'] . ', ' . |
|
| 48 | + $arguments['method'] . ', ' . |
|
| 49 | + $arguments['version'] . ', ' . |
|
| 50 | 50 | $arguments['package'] . ', ' . |
| 51 | 51 | $arguments['action'] . ')), ' . $arguments['params'] . ')'); |
| 52 | 52 | } |