Completed
Pull Request — master (#552)
by
unknown
01:29
created
src/Tools/Traits/ParamHelpers.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
     protected function cleanParams(array $params)
15 15
     {
16 16
         $values = [];
17
-        $params = array_filter($params, function ($details) {
17
+        $params = array_filter($params, function($details) {
18 18
             return is_string($details['value']) && strlen($details['value']);
19 19
         });
20 20
 
Please login to merge, or discard this patch.
src/Tools/Generator.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         ]);
70 70
 
71 71
         $parsedRoute = [
72
-            'id' => md5($this->getUri($route).':'.implode($this->getMethods($route))),
72
+            'id' => md5($this->getUri($route) . ':' . implode($this->getMethods($route))),
73 73
             'groupName' => $routeGroupName,
74 74
             'groupDescription' => $routeGroupDescription,
75 75
             'title' => $docBlock['short'],
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
             'cleanQueryParameters' => $this->cleanParams($queryParameters),
84 84
             'authenticated' => $this->getAuthStatusFromDocBlock($docBlock['tags']),
85 85
             'response' => $content,
86
-            'showresponse' => ! empty($content),
86
+            'showresponse' => !empty($content),
87 87
         ];
88 88
         $parsedRoute['headers'] = $rulesToApply['headers'] ?? [];
89 89
 
@@ -129,10 +129,10 @@  discard block
 block discarded – undo
129 129
     protected function getBodyParametersFromDocBlock(array $tags)
130 130
     {
131 131
         $parameters = collect($tags)
132
-            ->filter(function ($tag) {
132
+            ->filter(function($tag) {
133 133
                 return $tag instanceof Tag && $tag->getName() === 'bodyParam';
134 134
             })
135
-            ->mapWithKeys(function ($tag) {
135
+            ->mapWithKeys(function($tag) {
136 136
                 preg_match('/(.+?)\s+(.+?)\s+(required\s+)?(.*)/', $tag->getContent(), $content);
137 137
                 $content = preg_replace('/\s?No-example.?/', '', $content);
138 138
                 if (empty($content)) {
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 
153 153
                 $type = $this->normalizeParameterType($type);
154 154
                 list($description, $example) = $this->parseDescription($description, $type);
155
-                $value = is_null($example) && ! $this->shouldExcludeExample($tag) ? $this->generateDummyValue($type) : $example;
155
+                $value = is_null($example) && !$this->shouldExcludeExample($tag) ? $this->generateDummyValue($type) : $example;
156 156
 
157 157
                 return [$name => compact('type', 'description', 'required', 'value')];
158 158
             })->toArray();
@@ -205,10 +205,10 @@  discard block
 block discarded – undo
205 205
     protected function getQueryParametersFromDocBlock(array $tags)
206 206
     {
207 207
         $parameters = collect($tags)
208
-            ->filter(function ($tag) {
208
+            ->filter(function($tag) {
209 209
                 return $tag instanceof Tag && $tag->getName() === 'queryParam';
210 210
             })
211
-            ->mapWithKeys(function ($tag) {
211
+            ->mapWithKeys(function($tag) {
212 212
                 preg_match('/(.+?)\s+(required\s+)?(.*)/', $tag->getContent(), $content);
213 213
                 $content = preg_replace('/\s?No-example.?/', '', $content);
214 214
                 if (empty($content)) {
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
                 }
228 228
 
229 229
                 list($description, $value) = $this->parseDescription($description, 'string');
230
-                if (is_null($value) && ! $this->shouldExcludeExample($tag)) {
230
+                if (is_null($value) && !$this->shouldExcludeExample($tag)) {
231 231
                     $value = str_contains($description, ['number', 'count', 'page'])
232 232
                         ? $this->generateDummyValue('integer')
233 233
                         : $this->generateDummyValue('string');
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
     protected function getAuthStatusFromDocBlock(array $tags)
248 248
     {
249 249
         $authTag = collect($tags)
250
-            ->first(function ($tag) {
250
+            ->first(function($tag) {
251 251
                 return $tag instanceof Tag && strtolower($tag->getName()) === 'authenticated';
252 252
             });
253 253
 
@@ -330,25 +330,25 @@  discard block
 block discarded – undo
330 330
             $faker->seed($this->config->get('faker_seed'));
331 331
         }
332 332
         $fakeFactories = [
333
-            'integer' => function () use ($faker) {
333
+            'integer' => function() use ($faker) {
334 334
                 return $faker->numberBetween(1, 20);
335 335
             },
336
-            'number' => function () use ($faker) {
336
+            'number' => function() use ($faker) {
337 337
                 return $faker->randomFloat();
338 338
             },
339
-            'float' => function () use ($faker) {
339
+            'float' => function() use ($faker) {
340 340
                 return $faker->randomFloat();
341 341
             },
342
-            'boolean' => function () use ($faker) {
342
+            'boolean' => function() use ($faker) {
343 343
                 return $faker->boolean();
344 344
             },
345
-            'string' => function () use ($faker) {
345
+            'string' => function() use ($faker) {
346 346
                 return $faker->word;
347 347
             },
348
-            'array' => function () {
348
+            'array' => function() {
349 349
                 return [];
350 350
             },
351
-            'object' => function () {
351
+            'object' => function() {
352 352
                 return new \stdClass;
353 353
             },
354 354
         ];
Please login to merge, or discard this patch.