Переглянути джерело

Merge branch 'master' of github.com:mpociot/laravel-apidoc-generator

Marcel Pociot 8 роки тому
батько
коміт
2453a8b1dd

+ 1 - 1
composer.json

@@ -16,7 +16,7 @@
     ],
     "require": {
         "php": ">=5.5.0",
-        "fzaninotto/faker": "^1.6",
+        "fzaninotto/faker": "~1.0",
         "laravel/framework": "~5.0",
         "mpociot/documentarian": "^0.2.0",
         "mpociot/reflection-docblock": "^1.0",

+ 4 - 2
src/Mpociot/ApiDoc/Commands/GenerateDocumentation.php

@@ -93,7 +93,7 @@ class GenerateDocumentation extends Command
 
         $markdown = view('apidoc::documentarian')
             ->with('outputPath', $this->option('output'))
-            ->with('showPostmanCollectionButton', !$this->option('noPostmanCollection'))
+            ->with('showPostmanCollectionButton', ! $this->option('noPostmanCollection'))
             ->with('parsedRoutes', $parsedRoutes->all());
 
         if (! is_dir($outputPath)) {
@@ -228,14 +228,16 @@ class GenerateDocumentation extends Command
     }
 
     /**
-     * Generate Postman collection JSON file
+     * Generate Postman collection JSON file.
      *
      * @param Collection $routes
+     *
      * @return string
      */
     private function generatePostmanCollection(Collection $routes)
     {
         $writer = new CollectionWriter($routes);
+
         return $writer->getCollection();
     }
 }

+ 8 - 8
src/Mpociot/ApiDoc/Postman/CollectionWriter.php

@@ -14,6 +14,7 @@ class CollectionWriter
 
     /**
      * CollectionWriter constructor.
+     *
      * @param Collection $routeGroups
      */
     public function __construct(Collection $routeGroups)
@@ -29,7 +30,7 @@ class CollectionWriter
                 'name' => '',
                 '_postman_id' => Uuid::uuid1()->toString(),
                 'description' => '',
-                'schema' => 'https://schema.getpostman.com/json/collection/v2.0.0/collection.json'
+                'schema' => 'https://schema.getpostman.com/json/collection/v2.0.0/collection.json',
             ],
             'item' => $this->routeGroups->map(function ($routes, $groupName) {
                 return [
@@ -48,20 +49,19 @@ class CollectionWriter
                                             'key' => $key,
                                             'value' => isset($parameter['value']) ? $parameter['value'] : '',
                                             'type' => 'text',
-                                            'enabled' => true
+                                            'enabled' => true,
                                         ];
                                     })->values()->toArray(),
                                 ],
                                 'description' => $route['description'],
-                                'response' => []
-                            ]
+                                'response' => [],
+                            ],
                         ];
-                    })->toArray()
+                    })->toArray(),
                 ];
-            })->values()->toArray()
+            })->values()->toArray(),
         ];
 
         return json_encode($collection);
     }
-
-}
+}