Completed
Push — master ( 38fe88...b01404 )
by Marcel
06:30 queued 02:34
created
src/Mpociot/ApiDoc/Commands/GenerateDocumentation.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 
66 66
         $this->setUserToBeImpersonated($this->option('actAsUserId'));
67 67
 
68
-        if ($routePrefix === null && ! count($allowedRoutes)) {
68
+        if ($routePrefix === null && !count($allowedRoutes)) {
69 69
             $this->error('You must provide either a route prefix or a route to generate the documentation.');
70 70
 
71 71
             return false;
@@ -89,14 +89,14 @@  discard block
 block discarded – undo
89 89
     private function writeMarkdown($parsedRoutes)
90 90
     {
91 91
         $outputPath = $this->option('output');
92
-        $targetFile = $outputPath.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR.'index.md';
92
+        $targetFile = $outputPath . DIRECTORY_SEPARATOR . 'source' . DIRECTORY_SEPARATOR . 'index.md';
93 93
 
94 94
         $infoText = view('apidoc::partials.info')
95 95
             ->with('outputPath', $this->option('output'))
96
-            ->with('showPostmanCollectionButton', ! $this->option('noPostmanCollection'));
96
+            ->with('showPostmanCollectionButton', !$this->option('noPostmanCollection'));
97 97
 
98
-        $parsedRouteOutput = $parsedRoutes->map(function ($routeGroup) {
99
-            return $routeGroup->map(function ($route) {
98
+        $parsedRouteOutput = $parsedRoutes->map(function($routeGroup) {
99
+            return $routeGroup->map(function($route) {
100 100
                 $route['output'] = (string) view('apidoc::partials.route')->with('parsedRoute', $route);
101 101
 
102 102
                 return $route;
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
                 $frontmatter = trim($generatedFrontmatter[1], "\n");
120 120
             }
121 121
 
122
-            $parsedRouteOutput->transform(function ($routeGroup) use ($generatedDocumentation) {
123
-                return $routeGroup->transform(function ($route) use ($generatedDocumentation) {
124
-                    if (preg_match('/<!-- START_'.$route['id'].' -->(.*)<!-- END_'.$route['id'].' -->/is', $generatedDocumentation, $routeMatch) && ! $this->option('force')) {
122
+            $parsedRouteOutput->transform(function($routeGroup) use ($generatedDocumentation) {
123
+                return $routeGroup->transform(function($route) use ($generatedDocumentation) {
124
+                    if (preg_match('/<!-- START_' . $route['id'] . ' -->(.*)<!-- END_' . $route['id'] . ' -->/is', $generatedDocumentation, $routeMatch) && !$this->option('force')) {
125 125
                         $route['output'] = $routeMatch[0];
126 126
                     }
127 127
 
@@ -136,28 +136,28 @@  discard block
 block discarded – undo
136 136
             ->with('frontmatter', $frontmatter)
137 137
             ->with('infoText', $infoText)
138 138
             ->with('outputPath', $this->option('output'))
139
-            ->with('showPostmanCollectionButton', ! $this->option('noPostmanCollection'))
139
+            ->with('showPostmanCollectionButton', !$this->option('noPostmanCollection'))
140 140
             ->with('parsedRoutes', $parsedRouteOutput);
141 141
 
142
-        if (! is_dir($outputPath)) {
142
+        if (!is_dir($outputPath)) {
143 143
             $documentarian->create($outputPath);
144 144
         }
145 145
 
146 146
         file_put_contents($targetFile, $markdown);
147 147
 
148
-        $this->info('Wrote index.md to: '.$outputPath);
148
+        $this->info('Wrote index.md to: ' . $outputPath);
149 149
 
150 150
         $this->info('Generating API HTML code');
151 151
 
152 152
         $documentarian->generate($outputPath);
153 153
 
154
-        $this->info('Wrote HTML documentation to: '.$outputPath.'/public/index.html');
154
+        $this->info('Wrote HTML documentation to: ' . $outputPath . '/public/index.html');
155 155
 
156 156
 
157 157
         if ($this->option('noPostmanCollection') !== true) {
158 158
             $this->info('Generating Postman collection');
159 159
 
160
-            file_put_contents($outputPath.DIRECTORY_SEPARATOR.'collection.json', $this->generatePostmanCollection($parsedRoutes));
160
+            file_put_contents($outputPath . DIRECTORY_SEPARATOR . 'collection.json', $this->generatePostmanCollection($parsedRoutes));
161 161
         }
162 162
     }
163 163
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
      */
186 186
     private function setUserToBeImpersonated($actAs)
187 187
     {
188
-        if (! empty($actAs)) {
188
+        if (!empty($actAs)) {
189 189
             if (version_compare($this->laravel->version(), '5.2.0', '<')) {
190 190
                 $userModel = config('auth.model');
191 191
                 $user = $userModel::find($actAs);
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
             if (in_array($route->getName(), $allowedRoutes) || str_is($routePrefix, $route->getUri())) {
228 228
                 if ($this->isValidRoute($route)) {
229 229
                     $parsedRoutes[] = $generator->processRoute($route, $bindings, $withResponse);
230
-                    $this->info('Processed route: '.$route->getUri());
230
+                    $this->info('Processed route: ' . $route->getUri());
231 231
                 } else {
232
-                    $this->warn('Skipping route: '.$route->getUri().' - contains closure.');
232
+                    $this->warn('Skipping route: ' . $route->getUri() . ' - contains closure.');
233 233
                 }
234 234
             }
235 235
         }
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
         foreach ($routes as $route) {
254 254
             if (empty($allowedRoutes) || in_array($route->getName(), $allowedRoutes) || str_is($routePrefix, $route->uri())) {
255 255
                 $parsedRoutes[] = $generator->processRoute($route, $bindings, $withResponse);
256
-                $this->info('Processed route: '.$route->uri());
256
+                $this->info('Processed route: ' . $route->uri());
257 257
             }
258 258
         }
259 259
 
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
      */
268 268
     private function isValidRoute($route)
269 269
     {
270
-        return ! is_callable($route->getAction()['uses']) && ! is_null($route->getAction()['uses']);
270
+        return !is_callable($route->getAction()['uses']) && !is_null($route->getAction()['uses']);
271 271
     }
272 272
 
273 273
     /**
Please login to merge, or discard this patch.