Completed
Push — master ( 8afe83...248a05 )
by
unknown
01:22
created
src/Tools/Generator.php 1 patch
Spacing   +17 added lines, -17 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' => $routeTitle ?: $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
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
     protected function getRouteGroup(ReflectionClass $controller, array $methodDocBlock)
281 281
     {
282 282
         // @group tag on the method overrides that on the controller
283
-        if (! empty($methodDocBlock['tags'])) {
283
+        if (!empty($methodDocBlock['tags'])) {
284 284
             foreach ($methodDocBlock['tags'] as $tag) {
285 285
                 if ($tag->getName() === 'group') {
286 286
                     $routeGroupParts = explode("\n", trim($tag->getContent()));
@@ -347,25 +347,25 @@  discard block
 block discarded – undo
347 347
             $faker->seed($this->config->get('faker_seed'));
348 348
         }
349 349
         $fakeFactories = [
350
-            'integer' => function () use ($faker) {
350
+            'integer' => function() use ($faker) {
351 351
                 return $faker->numberBetween(1, 20);
352 352
             },
353
-            'number' => function () use ($faker) {
353
+            'number' => function() use ($faker) {
354 354
                 return $faker->randomFloat();
355 355
             },
356
-            'float' => function () use ($faker) {
356
+            'float' => function() use ($faker) {
357 357
                 return $faker->randomFloat();
358 358
             },
359
-            'boolean' => function () use ($faker) {
359
+            'boolean' => function() use ($faker) {
360 360
                 return $faker->boolean();
361 361
             },
362
-            'string' => function () use ($faker) {
362
+            'string' => function() use ($faker) {
363 363
                 return $faker->word;
364 364
             },
365
-            'array' => function () {
365
+            'array' => function() {
366 366
                 return [];
367 367
             },
368
-            'object' => function () {
368
+            'object' => function() {
369 369
                 return new \stdClass;
370 370
             },
371 371
         ];
Please login to merge, or discard this patch.
src/Tools/ResponseStrategies/TransformerTagsStrategy.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
             $fractal = new Manager();
51 51
 
52
-            if (! is_null(config('apidoc.fractal.serializer'))) {
52
+            if (!is_null(config('apidoc.fractal.serializer'))) {
53 53
                 $fractal->setSerializer(app(config('apidoc.fractal.serializer')));
54 54
             }
55 55
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      */
82 82
     private function getClassToBeTransformed(array $tags, ReflectionMethod $transformerMethod)
83 83
     {
84
-        $modelTag = Arr::first(array_filter($tags, function ($tag) {
84
+        $modelTag = Arr::first(array_filter($tags, function($tag) {
85 85
             return ($tag instanceof Tag) && strtolower($tag->getName()) == 'transformermodel';
86 86
         }));
87 87
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
             $type = $modelTag->getContent();
91 91
         } else {
92 92
             $parameter = Arr::first($transformerMethod->getParameters());
93
-            if ($parameter->hasType() && ! $parameter->getType()->isBuiltin() && class_exists((string) $parameter->getType())) {
93
+            if ($parameter->hasType() && !$parameter->getType()->isBuiltin() && class_exists((string) $parameter->getType())) {
94 94
                 // ladies and gentlemen, we have a type!
95 95
                 $type = (string) $parameter->getType();
96 96
             }
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
     private function getTransformerTag(array $tags)
143 143
     {
144 144
         $transFormerTags = array_values(
145
-            array_filter($tags, function ($tag) {
145
+            array_filter($tags, function($tag) {
146 146
                 return ($tag instanceof Tag) && in_array(strtolower($tag->getName()), ['transformer', 'transformercollection']);
147 147
             })
148 148
         );
Please login to merge, or discard this patch.
src/Tools/ResponseStrategies/ResponseCallStrategy.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
     public function __invoke(Route $route, array $tags, array $routeProps)
29 29
     {
30 30
         $rulesToApply = $routeProps['rules']['response_calls'] ?? [];
31
-        if (! $this->shouldMakeApiCall($route, $rulesToApply)) {
31
+        if (!$this->shouldMakeApiCall($route, $rulesToApply)) {
32 32
             return null;
33 33
         }
34 34
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
         try {
39 39
             $response = [$this->makeApiCall($request)];
40 40
         } catch (\Exception $e) {
41
-            echo 'Exception thrown during response call for ['.implode(',', $route->methods)."] {$route->uri}.\n";
41
+            echo 'Exception thrown during response call for [' . implode(',', $route->methods) . "] {$route->uri}.\n";
42 42
             if (Flags::$shouldBeVerbose) {
43 43
                 Utils::dumpException($e);
44 44
             } else {
@@ -175,14 +175,14 @@  discard block
 block discarded – undo
175 175
         // set URL and query parameters
176 176
         $uri = $request->getRequestUri();
177 177
         $query = $request->getQueryString();
178
-        if (! empty($query)) {
178
+        if (!empty($query)) {
179 179
             $uri .= "?$query";
180 180
         }
181 181
         $response = call_user_func_array([$dispatcher, strtolower($request->method())], [$uri]);
182 182
 
183 183
         // the response from the Dingo dispatcher is the 'raw' response from the controller,
184 184
         // so we have to ensure it's JSON first
185
-        if (! $response instanceof Response) {
185
+        if (!$response instanceof Response) {
186 186
             $response = response()->json($response);
187 187
         }
188 188
 
@@ -331,8 +331,8 @@  discard block
 block discarded – undo
331 331
         $prefix = 'HTTP_';
332 332
         foreach ($headers as $name => $value) {
333 333
             $name = strtr(strtoupper($name), '-', '_');
334
-            if (! Str::startsWith($name, $prefix) && $name !== 'CONTENT_TYPE') {
335
-                $name = $prefix.$name;
334
+            if (!Str::startsWith($name, $prefix) && $name !== 'CONTENT_TYPE') {
335
+                $name = $prefix . $name;
336 336
             }
337 337
             $server[$name] = $value;
338 338
         }
Please login to merge, or discard this patch.