Completed
Pull Request — master (#552)
by
unknown
01:29
created
src/Tools/ResponseStrategies/ResponseFileStrategy.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     {
35 35
         // Avoid "holes" in the keys of the filtered array, by using array_values on the filtered array
36 36
         $responseFileTags = array_values(
37
-            array_filter($tags, function ($tag) {
37
+            array_filter($tags, function($tag) {
38 38
                 return $tag instanceof Tag && strtolower($tag->getName()) === 'responsefile';
39 39
             })
40 40
         );
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
             return null;
44 44
         }
45 45
 
46
-        return array_map(function (Tag $responseFileTag) {
46
+        return array_map(function(Tag $responseFileTag) {
47 47
             preg_match('/^(\d{3})?\s?([\S]*[\s]*?)(\{.*\})?$/', $responseFileTag->getContent(), $result);
48 48
             $status = $result[1] ?: 200;
49 49
             $content = $result[2] ? file_get_contents(storage_path(trim($result[2])), true) : '{}';
50
-            $json = ! empty($result[3]) ? str_replace("'", '"', $result[3]) : '{}';
50
+            $json = !empty($result[3]) ? str_replace("'", '"', $result[3]) : '{}';
51 51
             $merged = array_merge(json_decode($content, true), json_decode($json, true));
52 52
 
53 53
             return new JsonResponse($merged, (int) $status);
Please login to merge, or discard this patch.
src/Tools/Generator.php 1 patch
Spacing   +18 added lines, -18 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,13 +129,13 @@  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
-            ->filter(function (Tag $tag) {
136
-                return ! $this->shouldExcludeExample($tag);
135
+            ->filter(function(Tag $tag) {
136
+                return !$this->shouldExcludeExample($tag);
137 137
             })
138
-            ->mapWithKeys(function ($tag) {
138
+            ->mapWithKeys(function($tag) {
139 139
                 preg_match('/(.+?)\s+(.+?)\s+(required\s+)?(.*)/', $tag->getContent(), $content);
140 140
                 if (empty($content)) {
141 141
                     // this means only name and type were supplied
@@ -207,13 +207,13 @@  discard block
 block discarded – undo
207 207
     protected function getQueryParametersFromDocBlock(array $tags)
208 208
     {
209 209
         $parameters = collect($tags)
210
-            ->filter(function ($tag) {
210
+            ->filter(function($tag) {
211 211
                 return $tag instanceof Tag && $tag->getName() === 'queryParam';
212 212
             })
213
-            ->filter(function (Tag $tag) {
214
-                return ! $this->shouldExcludeExample($tag);
213
+            ->filter(function(Tag $tag) {
214
+                return !$this->shouldExcludeExample($tag);
215 215
             })
216
-            ->mapWithKeys(function ($tag) {
216
+            ->mapWithKeys(function($tag) {
217 217
                 preg_match('/(.+?)\s+(required\s+)?(.*)/', $tag->getContent(), $content);
218 218
                 if (empty($content)) {
219 219
                     // this means only name was supplied
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
     protected function getAuthStatusFromDocBlock(array $tags)
252 252
     {
253 253
         $authTag = collect($tags)
254
-            ->first(function ($tag) {
254
+            ->first(function($tag) {
255 255
                 return $tag instanceof Tag && strtolower($tag->getName()) === 'authenticated';
256 256
             });
257 257
 
@@ -334,25 +334,25 @@  discard block
 block discarded – undo
334 334
             $faker->seed($this->config->get('faker_seed'));
335 335
         }
336 336
         $fakeFactories = [
337
-            'integer' => function () use ($faker) {
337
+            'integer' => function() use ($faker) {
338 338
                 return $faker->numberBetween(1, 20);
339 339
             },
340
-            'number' => function () use ($faker) {
340
+            'number' => function() use ($faker) {
341 341
                 return $faker->randomFloat();
342 342
             },
343
-            'float' => function () use ($faker) {
343
+            'float' => function() use ($faker) {
344 344
                 return $faker->randomFloat();
345 345
             },
346
-            'boolean' => function () use ($faker) {
346
+            'boolean' => function() use ($faker) {
347 347
                 return $faker->boolean();
348 348
             },
349
-            'string' => function () use ($faker) {
349
+            'string' => function() use ($faker) {
350 350
                 return $faker->word;
351 351
             },
352
-            'array' => function () {
352
+            'array' => function() {
353 353
                 return [];
354 354
             },
355
-            'object' => function () {
355
+            'object' => function() {
356 356
                 return new \stdClass;
357 357
             },
358 358
         ];
Please login to merge, or discard this patch.