Completed
Pull Request — master (#319)
by Marcel
50:03 queued 41:52
created
src/Mpociot/ApiDoc/Generators/AbstractGenerator.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
             $showresponse = true;
65 65
             $content = $response->getContent();
66 66
         }
67
-        if (! $response) {
67
+        if (!$response) {
68 68
             $transformerResponse = $this->getTransformerResponse($routeDescription['tags']);
69 69
             if ($transformerResponse) {
70 70
                 // we have a transformer response from the docblock ( @transformer || @transformercollection )
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
                 $content = $response->getContent();
74 74
             }
75 75
         }
76
-        if (! $response && $withResponse) {
76
+        if (!$response && $withResponse) {
77 77
             try {
78 78
                 $response = $this->getRouteResponse($route, $bindings, $headers);
79 79
                 if ($response->headers->get('Content-Type') === 'application/json') {
@@ -82,12 +82,12 @@  discard block
 block discarded – undo
82 82
                     $content = $response->getContent();
83 83
                 }
84 84
             } catch (\Exception $e) {
85
-                dump("Couldn't get response for route: ".implode(',', $this->getMethods($route)).'] '.$route->uri().'', $e);
85
+                dump("Couldn't get response for route: " . implode(',', $this->getMethods($route)) . '] ' . $route->uri() . '', $e);
86 86
             }
87 87
         }
88 88
 
89 89
         return $this->getParameters([
90
-            'id' => md5($this->getUri($route).':'.implode($this->getMethods($route))),
90
+            'id' => md5($this->getUri($route) . ':' . implode($this->getMethods($route))),
91 91
             'resource' => $routeGroup,
92 92
             'title' => $routeDescription['short'],
93 93
             'description' => $routeDescription['long'],
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
      */
118 118
     protected function getDocblockResponse($tags)
119 119
     {
120
-        $responseTags = array_filter($tags, function ($tag) {
121
-            if (! ($tag instanceof Tag)) {
120
+        $responseTags = array_filter($tags, function($tag) {
121
+            if (!($tag instanceof Tag)) {
122 122
                 return false;
123 123
             }
124 124
 
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
         }
177 177
 
178 178
         $values = collect($simplifiedRules)
179
-            ->filter(function ($values) {
179
+            ->filter(function($values) {
180 180
                 return in_array('array', $values);
181
-            })->map(function ($val, $key) {
181
+            })->map(function($val, $key) {
182 182
                 return [''];
183 183
             })->all();
184 184
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
         $methods = $this->getMethods($route);
200 200
 
201 201
         // Split headers into key - value pairs
202
-        $headers = collect($headers)->map(function ($value) {
202
+        $headers = collect($headers)->map(function($value) {
203 203
             $split = explode(':', $value); // explode to get key + values
204 204
             $key = array_shift($split); // extract the key and keep the values in the array
205 205
             $value = implode(':', $split); // implode values into string again
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
     {
224 224
         $uri = $this->getUri($route);
225 225
         foreach ($bindings as $model => $id) {
226
-            $uri = str_replace('{'.$model.'}', $id, $uri);
227
-            $uri = str_replace('{'.$model.'?}', $id, $uri);
226
+            $uri = str_replace('{' . $model . '}', $id, $uri);
227
+            $uri = str_replace('{' . $model . '?}', $id, $uri);
228 228
         }
229 229
 
230 230
         return $uri;
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 
289 289
         foreach ($reflectionMethod->getParameters() as $parameter) {
290 290
             $parameterType = $parameter->getClass();
291
-            if (! is_null($parameterType) && class_exists($parameterType->name)) {
291
+            if (!is_null($parameterType) && class_exists($parameterType->name)) {
292 292
                 $className = $parameterType->name;
293 293
 
294 294
                 if (is_subclass_of($className, FormRequest::class)) {
@@ -324,8 +324,8 @@  discard block
 block discarded – undo
324 324
      */
325 325
     protected function fancyImplode($arr, $first, $last)
326 326
     {
327
-        $arr = array_map(function ($value) {
328
-            return '`'.$value.'`';
327
+        $arr = array_map(function($value) {
328
+            return '`' . $value . '`';
329 329
         }, $arr);
330 330
         array_push($arr, implode($last, array_splice($arr, -2)));
331 331
 
@@ -335,8 +335,8 @@  discard block
 block discarded – undo
335 335
     protected function splitValuePairs($parameters, $first = 'is ', $last = 'or ')
336 336
     {
337 337
         $attribute = '';
338
-        collect($parameters)->map(function ($item, $key) use (&$attribute, $first, $last) {
339
-            $attribute .= '`'.$item.'` ';
338
+        collect($parameters)->map(function($item, $key) use (&$attribute, $first, $last) {
339
+            $attribute .= '`' . $item . '` ';
340 340
             if (($key + 1) % 2 === 0) {
341 341
                 $attribute .= $last;
342 342
             } else {
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
                 }
411 411
                 break;
412 412
             case 'between':
413
-                if (! isset($attributeData['type'])) {
413
+                if (!isset($attributeData['type'])) {
414 414
                     $attributeData['type'] = 'numeric';
415 415
                 }
416 416
                 $attributeData['description'][] = Description::parse($rule)->with($parameters)->getDescription();
@@ -578,8 +578,8 @@  discard block
 block discarded – undo
578 578
         foreach ($headers as $name => $value) {
579 579
             $name = strtr(strtoupper($name), '-', '_');
580 580
 
581
-            if (! Str::startsWith($name, $prefix) && $name !== 'CONTENT_TYPE') {
582
-                $name = $prefix.$name;
581
+            if (!Str::startsWith($name, $prefix) && $name !== 'CONTENT_TYPE') {
582
+                $name = $prefix . $name;
583 583
             }
584 584
 
585 585
             $server[$name] = $value;
Please login to merge, or discard this patch.