Completed
Pull Request — master (#686)
by
unknown
01:30
created
src/Commands/GenerateDocumentation.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
         $groupedRoutes = collect($parsedRoutes)
72 72
             ->groupBy('metadata.groupName')
73
-            ->sortBy(static function ($group) {
73
+            ->sortBy(static function($group) {
74 74
                 /* @var $group Collection */
75 75
                 return $group->first()['metadata']['groupName'];
76 76
             }, SORT_NATURAL);
@@ -101,23 +101,23 @@  discard block
 block discarded – undo
101 101
             $routePath = $generator->getUri($route);
102 102
 
103 103
             if ($this->isClosureRoute($route->getAction())) {
104
-                $this->warn(sprintf($messageFormat, 'Skipping', $routeMethods, $routePath).': Closure routes are not supported.');
104
+                $this->warn(sprintf($messageFormat, 'Skipping', $routeMethods, $routePath) . ': Closure routes are not supported.');
105 105
                 continue;
106 106
             }
107 107
 
108 108
             $routeControllerAndMethod = Utils::getRouteClassAndMethodNames($route->getAction());
109
-            if (! $this->isValidRoute($routeControllerAndMethod)) {
109
+            if (!$this->isValidRoute($routeControllerAndMethod)) {
110 110
                 $this->warn(sprintf($messageFormat, 'Skipping invalid', $routeMethods, $routePath));
111 111
                 continue;
112 112
             }
113 113
 
114
-            if (! $this->doesControllerMethodExist($routeControllerAndMethod)) {
115
-                $this->warn(sprintf($messageFormat, 'Skipping', $routeMethods, $routePath).': Controller method does not exist.');
114
+            if (!$this->doesControllerMethodExist($routeControllerAndMethod)) {
115
+                $this->warn(sprintf($messageFormat, 'Skipping', $routeMethods, $routePath) . ': Controller method does not exist.');
116 116
                 continue;
117 117
             }
118 118
 
119
-            if (! $this->isRouteVisibleForDocumentation($routeControllerAndMethod)) {
120
-                $this->warn(sprintf($messageFormat, 'Skipping', $routeMethods, $routePath).': @hideFromAPIDocumentation was specified.');
119
+            if (!$this->isRouteVisibleForDocumentation($routeControllerAndMethod)) {
120
+                $this->warn(sprintf($messageFormat, 'Skipping', $routeMethods, $routePath) . ': @hideFromAPIDocumentation was specified.');
121 121
                 continue;
122 122
             }
123 123
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
                 $parsedRoutes[] = $generator->processRoute($route, $routeItem->getRules());
126 126
                 $this->info(sprintf($messageFormat, 'Processed', $routeMethods, $routePath));
127 127
             } catch (\Exception $exception) {
128
-                $this->warn(sprintf($messageFormat, 'Skipping', $routeMethods, $routePath).'- Exception '.get_class($exception).' encountered : '.$exception->getMessage());
128
+                $this->warn(sprintf($messageFormat, 'Skipping', $routeMethods, $routePath) . '- Exception ' . get_class($exception) . ' encountered : ' . $exception->getMessage());
129 129
             }
130 130
         }
131 131
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
             $routeControllerAndMethod = implode('@', $routeControllerAndMethod);
144 144
         }
145 145
 
146
-        return ! is_callable($routeControllerAndMethod) && ! is_null($routeControllerAndMethod);
146
+        return !is_callable($routeControllerAndMethod) && !is_null($routeControllerAndMethod);
147 147
     }
148 148
 
149 149
     /**
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
         [$class, $method] = $routeControllerAndMethod;
170 170
         $reflection = new ReflectionClass($class);
171 171
 
172
-        if (! $reflection->hasMethod($method)) {
172
+        if (!$reflection->hasMethod($method)) {
173 173
             return false;
174 174
         }
175 175
 
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
             $phpdoc = new DocBlock($comment);
195 195
 
196 196
             return collect($phpdoc->getTags())
197
-                ->filter(function ($tag) {
197
+                ->filter(function($tag) {
198 198
                     return $tag->getName() === 'hideFromAPIDocumentation';
199 199
                 })
200 200
                 ->isEmpty();
Please login to merge, or discard this patch.
src/Extracting/Strategies/Responses/UseApiResourceTags.php 3 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
             ];
97 97
         } catch (\Exception $e) {
98 98
             echo 'Exception thrown when fetching Eloquent API resource response for ['.implode(',',
99
-                                                                                               $route->methods)."] {$route->uri}.\n";
99
+                                                                                                $route->methods)."] {$route->uri}.\n";
100 100
             if (Flags::$shouldBeVerbose) {
101 101
                 Utils::dumpException($e);
102 102
             } else {
@@ -117,10 +117,10 @@  discard block
 block discarded – undo
117 117
             array_filter($tags,
118 118
                 function ($tag) {
119 119
                     return ($tag instanceof Tag) && in_array(strtolower($tag->getName()),
120
-                                                             [
121
-                                                                 'apiresource',
122
-                                                                 'apiresourcecollection'
123
-                                                             ]);
120
+                                                                [
121
+                                                                    'apiresource',
122
+                                                                    'apiresourcecollection'
123
+                                                                ]);
124 124
                 })
125 125
         );
126 126
 
@@ -184,10 +184,10 @@  discard block
 block discarded – undo
184 184
                 $model = factory($type);
185 185
             }
186 186
             if ($useTransactions) {
187
-            	$model = $model->create();
187
+                $model = $model->create();
188 188
                 \DB::rollBack();
189 189
             }else{
190
-            	$model = $model->make();
190
+                $model = $model->make();
191 191
             }
192 192
 
193 193
             return $model;
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
                 // Collections can either use the regular JsonResource class (via `::collection()`,
77 77
                 // or a ResourceCollection (via `new`)
78 78
                 // See https://laravel.com/docs/5.8/eloquent-resources
79
-                $models   = [
79
+                $models = [
80 80
                     $modelInstance,
81 81
                     $this->instantiateApiResourceModel($model, $factoryStates)
82 82
                 ];
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
                 ],
96 96
             ];
97 97
         } catch (\Exception $e) {
98
-            echo 'Exception thrown when fetching Eloquent API resource response for ['.implode(',',
99
-                                                                                               $route->methods)."] {$route->uri}.\n";
98
+            echo 'Exception thrown when fetching Eloquent API resource response for [' . implode(',',
99
+                                                                                               $route->methods) . "] {$route->uri}.\n";
100 100
             if (Flags::$shouldBeVerbose) {
101 101
                 Utils::dumpException($e);
102 102
             } else {
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     private function getApiResourceTag(array $tags) {
116 116
         $apiResourceTags = array_values(
117 117
             array_filter($tags,
118
-                function ($tag) {
118
+                function($tag) {
119 119
                     return ($tag instanceof Tag) && in_array(strtolower($tag->getName()),
120 120
                                                              [
121 121
                                                                  'apiresource',
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      */
149 149
     private function getClassToBeTransformed(array $tags): string {
150 150
         $modelTag = Arr::first(array_filter($tags,
151
-            function ($tag) {
151
+            function($tag) {
152 152
                 return ($tag instanceof Tag) && strtolower($tag->getName()) == 'apiresourcemodel';
153 153
             }));
154 154
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
             if ($useTransactions) {
187 187
             	$model = $model->create();
188 188
                 \DB::rollBack();
189
-            }else{
189
+            } else {
190 190
             	$model = $model->make();
191 191
             }
192 192
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
     }
221 221
 
222 222
     private function getApiResourceStates(array $tags) {
223
-        $tag = collect($tags)->filter(function (Tag $tag) {
223
+        $tag = collect($tags)->filter(function(Tag $tag) {
224 224
             return strtolower($tag->getName()) === 'apiresourcestate';
225 225
         })->first();
226 226
 
@@ -228,9 +228,9 @@  discard block
 block discarded – undo
228 228
             return [];
229 229
         }
230 230
 
231
-        return collect(explode(',', $tag->getContent()))->transform(function ($item) {
231
+        return collect(explode(',', $tag->getContent()))->transform(function($item) {
232 232
             return trim($item);
233
-        })->filter(function ($item) {
233
+        })->filter(function($item) {
234 234
             return strlen($item) > 0;
235 235
         })->toArray();
236 236
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -186,7 +186,7 @@
 block discarded – undo
186 186
             if ($useTransactions) {
187 187
             	$model = $model->create();
188 188
                 \DB::rollBack();
189
-            }else{
189
+            } else{
190 190
             	$model = $model->make();
191 191
             }
192 192
 
Please login to merge, or discard this patch.