@@ -371,7 +371,7 @@ |
||
371 | 371 | * @param array $parts |
372 | 372 | * @param int $partLength |
373 | 373 | * |
374 | - * @return array |
|
374 | + * @return string[] |
|
375 | 375 | */ |
376 | 376 | private static function extractTsAndMod(array &$parts, $partLength) |
377 | 377 | { |
@@ -422,7 +422,7 @@ |
||
422 | 422 | "type" => $type, |
423 | 423 | ]; |
424 | 424 | if (strlen($format)) { |
425 | - $dto['properties'][$field]['format'] = $format; |
|
425 | + $dto['properties'][$field]['format'] = $format; |
|
426 | 426 | } |
427 | 427 | } |
428 | 428 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | if (!preg_match('/^\@ROOT/i', $domain)) { |
34 | 34 | $modules[] = str_replace('/', '', str_replace('@', '', $domain)); |
35 | 35 | } |
36 | - } catch (\Exception $e) { |
|
36 | + }catch (\Exception $e) { |
|
37 | 37 | $modules[] = $e->getMessage(); |
38 | 38 | } |
39 | 39 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function extractApiEndpoints($module) |
53 | 53 | { |
54 | - $module_path = CORE_DIR . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . "Api"; |
|
54 | + $module_path = CORE_DIR.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR."Api"; |
|
55 | 55 | $endpoints = []; |
56 | 56 | if (file_exists($module_path)) { |
57 | 57 | $finder = new Finder(); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | if (count($finder)) { |
60 | 60 | /** @var \SplFileInfo $file */ |
61 | 61 | foreach ($finder as $file) { |
62 | - $namespace = "\\{$module}\\Api\\" . str_replace('.php', '', $file->getFilename()); |
|
62 | + $namespace = "\\{$module}\\Api\\".str_replace('.php', '', $file->getFilename()); |
|
63 | 63 | $endpoints[$namespace] = $this->extractApiInfo($namespace); |
64 | 64 | } |
65 | 65 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | if (NULL !== $mInfo) { |
89 | 89 | $info[] = $mInfo; |
90 | 90 | } |
91 | - } catch (\Exception $e) { |
|
91 | + }catch (\Exception $e) { |
|
92 | 92 | Logger::getInstance()->errorLog($e->getMessage()); |
93 | 93 | } |
94 | 94 | } |
@@ -221,9 +221,9 @@ discard block |
||
221 | 221 | if ($reflector->isSubclassOf(self::DTO_INTERFACE)) { |
222 | 222 | foreach ($reflector->getProperties(\ReflectionMethod::IS_PUBLIC) as $property) { |
223 | 223 | $type = $this->extractVarType($property->getDocComment()); |
224 | - if(class_exists($type)) { |
|
224 | + if (class_exists($type)) { |
|
225 | 225 | $properties[$property->getName()] = $this->extractModelFields($type); |
226 | - } else { |
|
226 | + }else { |
|
227 | 227 | $properties[$property->getName()] = $type; |
228 | 228 | } |
229 | 229 | } |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | */ |
243 | 243 | protected function extractReturn($model, $comments = '') |
244 | 244 | { |
245 | - $modelDto = []; |
|
245 | + $modelDto = []; |
|
246 | 246 | preg_match('/\@return\ (.*)\((.*)\)\n/i', $comments, $returnTypes); |
247 | 247 | if (count($returnTypes)) { |
248 | 248 | // Extract principal DTO information |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | } elseif (null !== $reflector && $reflector->isSubclassOf(self::DTO_INTERFACE)) { |
296 | 296 | $payload = $this->extractDtoProperties($namespace); |
297 | 297 | } |
298 | - } catch (\Exception $e) { |
|
298 | + }catch (\Exception $e) { |
|
299 | 299 | Logger::getInstance()->errorLog($e->getMessage()); |
300 | 300 | } |
301 | 301 | |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | if (in_array($methodInfo['method'], ['POST', 'PUT'])) { |
332 | 332 | $methodInfo['payload'] = $this->extractPayload($modelNamespace, $docComments); |
333 | 333 | } |
334 | - } catch (\Exception $e) { |
|
334 | + }catch (\Exception $e) { |
|
335 | 335 | jpre($e->getMessage()); |
336 | 336 | Logger::getInstance()->errorLog($e->getMessage()); |
337 | 337 | } |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | */ |
350 | 350 | public static function translateSwaggerFormats($format) |
351 | 351 | { |
352 | - switch(strtolower($format)) { |
|
352 | + switch (strtolower($format)) { |
|
353 | 353 | case 'bool': |
354 | 354 | case 'boolean': |
355 | 355 | $swaggerType = 'boolean'; |
@@ -410,13 +410,13 @@ discard block |
||
410 | 410 | ]]); |
411 | 411 | if (array_key_exists($subDtoName, $subDto)) { |
412 | 412 | $definitions = $subDto; |
413 | - } else { |
|
413 | + }else { |
|
414 | 414 | $definitions[$subDtoName] = $subDto; |
415 | 415 | } |
416 | 416 | $dto['properties'][$field] = [ |
417 | - '$ref' => "#/definitions/" . $subDtoName, |
|
417 | + '$ref' => "#/definitions/".$subDtoName, |
|
418 | 418 | ]; |
419 | - } else { |
|
419 | + }else { |
|
420 | 420 | list($type, $format) = self::translateSwaggerFormats($format); |
421 | 421 | $dto['properties'][$field] = [ |
422 | 422 | "type" => $type, |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | "url" => Router::getInstance()->getRoute(''), |
454 | 454 | ] |
455 | 455 | ]; |
456 | - foreach($endpoints as $model) { |
|
456 | + foreach ($endpoints as $model) { |
|
457 | 457 | foreach ($model as $endpoint) { |
458 | 458 | $dtos += self::extractSwaggerDefinition($endpoint); |
459 | 459 | } |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | protected function extractDtoName($dto, $isArray = false) |
473 | 473 | { |
474 | 474 | $dto = explode('\\', $dto); |
475 | - $modelDto = array_pop($dto) . "Dto"; |
|
475 | + $modelDto = array_pop($dto)."Dto"; |
|
476 | 476 | if ($isArray) { |
477 | 477 | $modelDto .= "List"; |
478 | 478 | } |