@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $data = [ |
159 | 159 | 'openapi' => '3.0.0', |
160 | 160 | 'info' => [ |
161 | - 'version' => (string)$version, |
|
161 | + 'version' => (string) $version, |
|
162 | 162 | 'title' => 'Nette API', |
163 | 163 | ], |
164 | 164 | 'servers' => [ |
@@ -217,11 +217,11 @@ discard block |
||
217 | 217 | 'paths' => $this->getPaths($apis, $baseUrl, $basePath), |
218 | 218 | ]; |
219 | 219 | |
220 | - if (!$securitySchemes) { |
|
220 | + if ( ! $securitySchemes) { |
|
221 | 221 | unset($data['components']['securitySchemes']); |
222 | 222 | } |
223 | 223 | |
224 | - if (!empty($this->definitions)) { |
|
224 | + if ( ! empty($this->definitions)) { |
|
225 | 225 | $data['components']['schemas'] = array_merge($this->definitions, $data['components']['schemas']); |
226 | 226 | } |
227 | 227 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | |
236 | 236 | private function getApis(string $version): array |
237 | 237 | { |
238 | - return array_filter($this->apiDecider->getApis(), function (Api $api) use ($version) { |
|
238 | + return array_filter($this->apiDecider->getApis(), function(Api $api) use ($version) { |
|
239 | 239 | return $version === $api->getEndpoint()->getVersion(); |
240 | 240 | }); |
241 | 241 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | $path = str_replace([$baseUrl, $basePath], '', $this->apiLink->link($api->getEndpoint())); |
256 | 256 | $responses = []; |
257 | 257 | |
258 | - if (!$this->isPathAllowed($path, $api->getEndpoint()->getMethod())) { |
|
258 | + if ( ! $this->isPathAllowed($path, $api->getEndpoint()->getMethod())) { |
|
259 | 259 | continue; |
260 | 260 | } |
261 | 261 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | $parameters = $this->createParamsList($handler); |
273 | 273 | $requestBody = $this->createRequestBody($handler); |
274 | 274 | |
275 | - if (!empty($parameters) || !empty($requestBody)) { |
|
275 | + if ( ! empty($parameters) || ! empty($requestBody)) { |
|
276 | 276 | $responses[IResponse::S400_BAD_REQUEST] = [ |
277 | 277 | 'description' => 'Bad request', |
278 | 278 | 'content' => [ |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | |
288 | 288 | $authorization = $api->getAuthorization(); |
289 | 289 | |
290 | - if (!$authorization instanceof NoAuthorization) { |
|
290 | + if ( ! $authorization instanceof NoAuthorization) { |
|
291 | 291 | $responses[IResponse::S403_FORBIDDEN] = [ |
292 | 292 | 'description' => 'Operation forbidden', |
293 | 293 | 'content' => [ |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | foreach ($handler->outputs() as $output) { |
315 | 315 | if ($output instanceof JsonOutput) { |
316 | 316 | $schema = $this->transformSchema(json_decode($output->getSchema(), true)); |
317 | - if (!isset($responses[$output->getCode()])) { |
|
317 | + if ( ! isset($responses[$output->getCode()])) { |
|
318 | 318 | $responses[$output->getCode()] = [ |
319 | 319 | 'description' => $output->getDescription(), |
320 | 320 | 'content' => [ |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | ], |
324 | 324 | ], |
325 | 325 | ]; |
326 | - if (!empty($examples = $output->getExamples())) { |
|
326 | + if ( ! empty($examples = $output->getExamples())) { |
|
327 | 327 | if (count($examples) === 1) { |
328 | 328 | $example = is_array($output->getExample()) ? $output->getExample() : json_decode($output->getExample(), true); |
329 | 329 | $responses[$output->getCode()]['content']['application/json; charset=utf-8']['example'] = $example; |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | } |
336 | 336 | } |
337 | 337 | } else { |
338 | - if (!isset($responses[$output->getCode()]['content']['application/json; charset=utf-8']['schema']['oneOf'])) { |
|
338 | + if ( ! isset($responses[$output->getCode()]['content']['application/json; charset=utf-8']['schema']['oneOf'])) { |
|
339 | 339 | $tmp = $responses[$output->getCode()]['content']['application/json; charset=utf-8']['schema']; |
340 | 340 | unset($responses[$output->getCode()]['content']['application/json; charset=utf-8']['schema']); |
341 | 341 | $responses[$output->getCode()]['content']['application/json; charset=utf-8']['schema'] = [ |
@@ -362,11 +362,11 @@ discard block |
||
362 | 362 | } |
363 | 363 | } |
364 | 364 | |
365 | - if (!empty($parameters)) { |
|
365 | + if ( ! empty($parameters)) { |
|
366 | 366 | $settings['parameters'] = $parameters; |
367 | 367 | } |
368 | 368 | |
369 | - if (!empty($requestBody)) { |
|
369 | + if ( ! empty($requestBody)) { |
|
370 | 370 | $settings['requestBody'] = $requestBody; |
371 | 371 | } |
372 | 372 | |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | foreach ($handler->params() as $param) { |
526 | 526 | if ($param instanceof JsonInputParam) { |
527 | 527 | $schema = json_decode($param->getSchema(), true); |
528 | - if (!empty($examples = $param->getExamples())) { |
|
528 | + if ( ! empty($examples = $param->getExamples())) { |
|
529 | 529 | if (count($examples) === 1) { |
530 | 530 | $schema['example'] = is_array($param->getExample()) ? $param->getExample() : json_decode($param->getExample(), true); |
531 | 531 | } else { |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | $schema = [ |
549 | 549 | 'type' => 'string', |
550 | 550 | ]; |
551 | - if (!empty($examples = $param->getExamples())) { |
|
551 | + if ( ! empty($examples = $param->getExamples())) { |
|
552 | 552 | if (count($examples) === 1) { |
553 | 553 | $schema['example'] = $param->getExample(); |
554 | 554 | } else { |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | } |
618 | 618 | } |
619 | 619 | |
620 | - if (!empty($requestBody['properties'])) { |
|
620 | + if ( ! empty($requestBody['properties'])) { |
|
621 | 621 | $requestBodySchema = [ |
622 | 622 | 'type' => 'object', |
623 | 623 | 'properties' => $requestBody['properties'], |