Passed
Push — master ( 0a9e87...9dd3d7 )
by Fran
03:31
created
src/services/DocumentorService.php 1 patch
Spacing   +16 added lines, -16 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,9 +67,9 @@  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
                         $info = $this->extractApiInfo($namespace, $module_name);
72
-                        if(!empty($info)) {
72
+                        if (!empty($info)) {
73 73
                             $endpoints[$namespace] = $info;
74 74
                         }
75 75
                     }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
         public function extractApiInfo($namespace, $module)
89 89
         {
90 90
             $info = [];
91
-            if(class_exists($namespace)) {
91
+            if (class_exists($namespace)) {
92 92
                 $reflection = new \ReflectionClass($namespace);
93 93
                 foreach ($reflection->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) {
94 94
                     try {
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
                         if (NULL !== $mInfo) {
97 97
                             $info[] = $mInfo;
98 98
                         }
99
-                    } catch (\Exception $e) {
99
+                    }catch (\Exception $e) {
100 100
                         Logger::getInstance()->errorLog($e->getMessage());
101 101
                     }
102 102
                 }
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
          */
255 255
         protected function extractReturn($model, $comments = '')
256 256
         {
257
-            $modelDto  = [];
257
+            $modelDto = [];
258 258
             preg_match('/\@return\ (.*)\((.*)\)\n/i', $comments, $returnTypes);
259 259
             if (count($returnTypes)) {
260 260
                 // Extract principal DTO information
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
                 } elseif (null !== $reflector && $reflector->isSubclassOf(self::DTO_INTERFACE)) {
308 308
                     $payload = $this->extractDtoProperties($namespace);
309 309
                 }
310
-            } catch (\Exception $e) {
310
+            }catch (\Exception $e) {
311 311
                 Logger::getInstance()->errorLog($e->getMessage());
312 312
             }
313 313
 
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
                         if (in_array($methodInfo['method'], ['POST', 'PUT'])) {
345 345
                             $methodInfo['payload'] = $this->extractPayload($modelNamespace, $docComments);
346 346
                         }
347
-                    } catch (\Exception $e) {
347
+                    }catch (\Exception $e) {
348 348
                         jpre($e->getMessage());
349 349
                         Logger::getInstance()->errorLog($e->getMessage());
350 350
                     }
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
          */
363 363
         public static function translateSwaggerFormats($format)
364 364
         {
365
-            switch(strtolower($format)) {
365
+            switch (strtolower($format)) {
366 366
                 case 'bool':
367 367
                 case 'boolean':
368 368
                     $swaggerType = 'boolean';
@@ -423,13 +423,13 @@  discard block
 block discarded – undo
423 423
                             ]]);
424 424
                             if (array_key_exists($subDtoName, $subDto)) {
425 425
                                 $definitions = $subDto;
426
-                            } else {
426
+                            }else {
427 427
                                 $definitions[$subDtoName] = $subDto;
428 428
                             }
429 429
                             $dto['properties'][$field] = [
430
-                                '$ref' => "#/definitions/" . $subDtoName,
430
+                                '$ref' => "#/definitions/".$subDtoName,
431 431
                             ];
432
-                        } else {
432
+                        }else {
433 433
                             list($type, $format) = self::translateSwaggerFormats($format);
434 434
                             $dto['properties'][$field] = [
435 435
                                 "type" => $type,
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
                     "url" => Router::getInstance()->getRoute(''),
467 467
                 ]
468 468
             ];
469
-            foreach($endpoints as $model) {
469
+            foreach ($endpoints as $model) {
470 470
                 foreach ($model as $endpoint) {
471 471
                     $dtos += self::extractSwaggerDefinition($endpoint);
472 472
                 }
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
         protected function extractDtoName($dto, $isArray = false)
486 486
         {
487 487
             $dto = explode('\\', $dto);
488
-            $modelDto = array_pop($dto) . "Dto";
488
+            $modelDto = array_pop($dto)."Dto";
489 489
             if ($isArray) {
490 490
                 $modelDto .= "List";
491 491
             }
Please login to merge, or discard this patch.