@@ -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 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | if (count($args) < 3) { |
29 | 29 | $message = "Invalid link destination, too few arguments."; |
30 | - if (!Debugger::$productionMode) { |
|
30 | + if ( ! Debugger::$productionMode) { |
|
31 | 31 | throw new InvalidLinkException($message); |
32 | 32 | } |
33 | 33 | Debugger::log($message, Debugger::EXCEPTION); |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | |
45 | 45 | return $writer->write('echo ($presenter->context->getByType("' . ApiLink::class . '"))' . |
46 | 46 | '->link((new Tomaj\NetteApi\EndpointIdentifier(' . |
47 | - $arguments['method'] . ', ' . |
|
48 | - $arguments['version'] . ', ' . |
|
47 | + $arguments['method'] . ', ' . |
|
48 | + $arguments['version'] . ', ' . |
|
49 | 49 | $arguments['package'] . ', ' . |
50 | 50 | $arguments['action'] . ')), ' . $arguments['params'] . ')'); |
51 | 51 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $data = [ |
149 | 149 | 'openapi' => '3.0.0', |
150 | 150 | 'info' => [ |
151 | - 'version' => (string)$version, |
|
151 | + 'version' => (string) $version, |
|
152 | 152 | 'title' => 'Nette API', |
153 | 153 | ], |
154 | 154 | 'servers' => [ |
@@ -207,11 +207,11 @@ discard block |
||
207 | 207 | 'paths' => $this->getPaths($apis, $baseUrl, $basePath), |
208 | 208 | ]; |
209 | 209 | |
210 | - if (!$securitySchemes) { |
|
210 | + if ( ! $securitySchemes) { |
|
211 | 211 | unset($data['components']['securitySchemes']); |
212 | 212 | } |
213 | 213 | |
214 | - if (!empty($this->definitions)) { |
|
214 | + if ( ! empty($this->definitions)) { |
|
215 | 215 | $data['components']['schemas'] = array_merge($this->definitions, $data['components']['schemas']); |
216 | 216 | } |
217 | 217 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | |
226 | 226 | private function getApis(int $version): array |
227 | 227 | { |
228 | - return array_filter($this->apiDecider->getApis(), function (Api $api) use ($version) { |
|
228 | + return array_filter($this->apiDecider->getApis(), function(Api $api) use ($version) { |
|
229 | 229 | return $version === $api->getEndpoint()->getVersion(); |
230 | 230 | }); |
231 | 231 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | $parameters = $this->createParamsList($handler); |
286 | 286 | $requestBody = $this->createRequestBody($handler); |
287 | 287 | |
288 | - if (!empty($parameters) || !empty($requestBody)) { |
|
288 | + if ( ! empty($parameters) || ! empty($requestBody)) { |
|
289 | 289 | $responses[IResponse::S400_BAD_REQUEST] = [ |
290 | 290 | 'description' => 'Bad request', |
291 | 291 | 'content' => [ |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | |
301 | 301 | $authorization = $api->getAuthorization(); |
302 | 302 | |
303 | - if (!$authorization instanceof NoAuthorization) { |
|
303 | + if ( ! $authorization instanceof NoAuthorization) { |
|
304 | 304 | $responses[IResponse::S403_FORBIDDEN] = [ |
305 | 305 | 'description' => 'Operation forbidden', |
306 | 306 | 'content' => [ |
@@ -324,11 +324,11 @@ discard block |
||
324 | 324 | ], |
325 | 325 | ]; |
326 | 326 | |
327 | - if (!empty($parameters)) { |
|
327 | + if ( ! empty($parameters)) { |
|
328 | 328 | $settings['parameters'] = $parameters; |
329 | 329 | } |
330 | 330 | |
331 | - if (!empty($requestBody)) { |
|
331 | + if ( ! empty($requestBody)) { |
|
332 | 332 | $settings['requestBody'] = $requestBody; |
333 | 333 | } |
334 | 334 | |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | } |
513 | 513 | } |
514 | 514 | |
515 | - if (!empty($requestBody['properties'])) { |
|
515 | + if ( ! empty($requestBody['properties'])) { |
|
516 | 516 | $requestBodySchema = [ |
517 | 517 | 'type' => 'object', |
518 | 518 | 'properties' => $requestBody['properties'], |