Passed
Push — master ( 9cde44...0a9e87 )
by Fran
03:13
created
src/services/DocumentorService.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
                         if (!preg_match('/^ROOT/i', $module)) {
38 38
                             $modules[] = [
39 39
                                 'name' => $module,
40
-                                'path' => realpath($info['template'] . DIRECTORY_SEPARATOR . '..'),
40
+                                'path' => realpath($info['template'].DIRECTORY_SEPARATOR.'..'),
41 41
                             ];
42 42
                         }
43
-                    } catch (\Exception $e) {
43
+                    }catch (\Exception $e) {
44 44
                         $modules[] = $e->getMessage();
45 45
                     }
46 46
                 }
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
          */
59 59
         public function extractApiEndpoints(array $module)
60 60
         {
61
-            $module_path = $module['path'] . DIRECTORY_SEPARATOR . 'Api';
61
+            $module_path = $module['path'].DIRECTORY_SEPARATOR.'Api';
62 62
             $module_name = $module['name'];
63 63
             $endpoints = [];
64 64
             if (file_exists($module_path)) {
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
                 if (count($finder)) {
68 68
                     /** @var \SplFileInfo $file */
69 69
                     foreach ($finder as $file) {
70
-                        $namespace = "\\{$module_name}\\Api\\" . str_replace('.php', '', $file->getFilename());
70
+                        $namespace = "\\{$module_name}\\Api\\".str_replace('.php', '', $file->getFilename());
71 71
                         $endpoints[$namespace] = $this->extractApiInfo($namespace, $module_name);
72 72
                     }
73 73
                 }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
                     if (NULL !== $mInfo) {
93 93
                         $info[] = $mInfo;
94 94
                     }
95
-                } catch (\Exception $e) {
95
+                }catch (\Exception $e) {
96 96
                     Logger::getInstance()->errorLog($e->getMessage());
97 97
                 }
98 98
             }
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
          */
250 250
         protected function extractReturn($model, $comments = '')
251 251
         {
252
-            $modelDto  = [];
252
+            $modelDto = [];
253 253
             preg_match('/\@return\ (.*)\((.*)\)\n/i', $comments, $returnTypes);
254 254
             if (count($returnTypes)) {
255 255
                 // Extract principal DTO information
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
                 } elseif (null !== $reflector && $reflector->isSubclassOf(self::DTO_INTERFACE)) {
303 303
                     $payload = $this->extractDtoProperties($namespace);
304 304
                 }
305
-            } catch (\Exception $e) {
305
+            }catch (\Exception $e) {
306 306
                 Logger::getInstance()->errorLog($e->getMessage());
307 307
             }
308 308
 
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
                         if (in_array($methodInfo['method'], ['POST', 'PUT'])) {
340 340
                             $methodInfo['payload'] = $this->extractPayload($modelNamespace, $docComments);
341 341
                         }
342
-                    } catch (\Exception $e) {
342
+                    }catch (\Exception $e) {
343 343
                         jpre($e->getMessage());
344 344
                         Logger::getInstance()->errorLog($e->getMessage());
345 345
                     }
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
          */
358 358
         public static function translateSwaggerFormats($format)
359 359
         {
360
-            switch(strtolower($format)) {
360
+            switch (strtolower($format)) {
361 361
                 case 'bool':
362 362
                 case 'boolean':
363 363
                     $swaggerType = 'boolean';
@@ -418,13 +418,13 @@  discard block
 block discarded – undo
418 418
                             ]]);
419 419
                             if (array_key_exists($subDtoName, $subDto)) {
420 420
                                 $definitions = $subDto;
421
-                            } else {
421
+                            }else {
422 422
                                 $definitions[$subDtoName] = $subDto;
423 423
                             }
424 424
                             $dto['properties'][$field] = [
425
-                                '$ref' => "#/definitions/" . $subDtoName,
425
+                                '$ref' => "#/definitions/".$subDtoName,
426 426
                             ];
427
-                        } else {
427
+                        }else {
428 428
                             list($type, $format) = self::translateSwaggerFormats($format);
429 429
                             $dto['properties'][$field] = [
430 430
                                 "type" => $type,
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
                     "url" => Router::getInstance()->getRoute(''),
462 462
                 ]
463 463
             ];
464
-            foreach($endpoints as $model) {
464
+            foreach ($endpoints as $model) {
465 465
                 foreach ($model as $endpoint) {
466 466
                     $dtos += self::extractSwaggerDefinition($endpoint);
467 467
                 }
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
         protected function extractDtoName($dto, $isArray = false)
481 481
         {
482 482
             $dto = explode('\\', $dto);
483
-            $modelDto = array_pop($dto) . "Dto";
483
+            $modelDto = array_pop($dto)."Dto";
484 484
             if ($isArray) {
485 485
                 $modelDto .= "List";
486 486
             }
Please login to merge, or discard this patch.