Completed
Push — master ( e8ae8d...5e8e24 )
by
unknown
02:41 queued 53s
created
src/Mpociot/ApiDoc/Generators/AbstractGenerator.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
             $response = $docblockResponse;
76 76
             $showresponse = true;
77 77
         }
78
-        if (! $response) {
78
+        if (!$response) {
79 79
             $transformerResponse = $this->getTransformerResponse($routeDescription['tags']);
80 80
             if ($transformerResponse) {
81 81
                 // we have a transformer response from the docblock ( @transformer || @transformercollection )
@@ -83,18 +83,18 @@  discard block
 block discarded – undo
83 83
                 $showresponse = true;
84 84
             }
85 85
         }
86
-        if (! $response && $withResponse) {
86
+        if (!$response && $withResponse) {
87 87
             try {
88 88
                 $response = $this->getRouteResponse($route, $bindings, $headers);
89 89
             } catch (\Exception $e) {
90
-                echo "Couldn't get response for route: ".implode(',', $this->getMethods($route)).$route->uri().']: '.$e->getMessage()."\n";
90
+                echo "Couldn't get response for route: " . implode(',', $this->getMethods($route)) . $route->uri() . ']: ' . $e->getMessage() . "\n";
91 91
             }
92 92
         }
93 93
 
94 94
         $content = $this->getResponseContent($response);
95 95
 
96 96
         return $this->getParameters([
97
-            'id' => md5($this->getUri($route).':'.implode($this->getMethods($route))),
97
+            'id' => md5($this->getUri($route) . ':' . implode($this->getMethods($route))),
98 98
             'resource' => $routeGroup,
99 99
             'title' => $routeDescription['short'],
100 100
             'description' => $routeDescription['long'],
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
      */
125 125
     protected function getDocblockResponse($tags)
126 126
     {
127
-        $responseTags = array_filter($tags, function ($tag) {
128
-            if (! ($tag instanceof Tag)) {
127
+        $responseTags = array_filter($tags, function($tag) {
128
+            if (!($tag instanceof Tag)) {
129 129
                 return false;
130 130
             }
131 131
 
@@ -183,9 +183,9 @@  discard block
 block discarded – undo
183 183
         // Laravel will ignore the nested array rules unless the key referenced exists and is an array
184 184
         // So we'll create an empty array for each array attribute
185 185
         $values = collect($newRules)
186
-            ->filter(function ($values) {
186
+            ->filter(function($values) {
187 187
                 return in_array('array', $values);
188
-            })->map(function ($val, $key) {
188
+            })->map(function($val, $key) {
189 189
                 return [str_random()];
190 190
             })->all();
191 191
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
         $methods = $this->getMethods($route);
209 209
 
210 210
         // Split headers into key - value pairs
211
-        $headers = collect($headers)->map(function ($value) {
211
+        $headers = collect($headers)->map(function($value) {
212 212
             $split = explode(':', $value); // explode to get key + values
213 213
             $key = array_shift($split); // extract the key and keep the values in the array
214 214
             $value = implode(':', $split); // implode values into string again
@@ -232,8 +232,8 @@  discard block
 block discarded – undo
232 232
     {
233 233
         $uri = $this->getUri($route);
234 234
         foreach ($bindings as $model => $id) {
235
-            $uri = str_replace('{'.$model.'}', $id, $uri);
236
-            $uri = str_replace('{'.$model.'?}', $id, $uri);
235
+            $uri = str_replace('{' . $model . '}', $id, $uri);
236
+            $uri = str_replace('{' . $model . '?}', $id, $uri);
237 237
         }
238 238
 
239 239
         return $uri;
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 
298 298
         foreach ($reflectionMethod->getParameters() as $parameter) {
299 299
             $parameterType = $parameter->getClass();
300
-            if (! is_null($parameterType) && class_exists($parameterType->name)) {
300
+            if (!is_null($parameterType) && class_exists($parameterType->name)) {
301 301
                 $className = $parameterType->name;
302 302
 
303 303
                 if (is_subclass_of($className, FormRequest::class)) {
@@ -333,8 +333,8 @@  discard block
 block discarded – undo
333 333
      */
334 334
     protected function fancyImplode($arr, $first, $last)
335 335
     {
336
-        $arr = array_map(function ($value) {
337
-            return '`'.$value.'`';
336
+        $arr = array_map(function($value) {
337
+            return '`' . $value . '`';
338 338
         }, $arr);
339 339
         array_push($arr, implode($last, array_splice($arr, -2)));
340 340
 
@@ -344,8 +344,8 @@  discard block
 block discarded – undo
344 344
     protected function splitValuePairs($parameters, $first = 'is ', $last = 'or ')
345 345
     {
346 346
         $attribute = '';
347
-        collect($parameters)->map(function ($item, $key) use (&$attribute, $first, $last) {
348
-            $attribute .= '`'.$item.'` ';
347
+        collect($parameters)->map(function($item, $key) use (&$attribute, $first, $last) {
348
+            $attribute .= '`' . $item . '` ';
349 349
             if (($key + 1) % 2 === 0) {
350 350
                 $attribute .= $last;
351 351
             } else {
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
                 }
430 430
                 break;
431 431
             case 'between':
432
-                if (! isset($attributeData['type'])) {
432
+                if (!isset($attributeData['type'])) {
433 433
                     $attributeData['type'] = 'numeric';
434 434
                 }
435 435
                 $attributeData['description'][] = Description::parse($rule)->with($parameters)->getDescription();
@@ -608,8 +608,8 @@  discard block
 block discarded – undo
608 608
         foreach ($headers as $name => $value) {
609 609
             $name = strtr(strtoupper($name), '-', '_');
610 610
 
611
-            if (! Str::startsWith($name, $prefix) && $name !== 'CONTENT_TYPE') {
612
-                $name = $prefix.$name;
611
+            if (!Str::startsWith($name, $prefix) && $name !== 'CONTENT_TYPE') {
612
+                $name = $prefix . $name;
613 613
             }
614 614
 
615 615
             $server[$name] = $value;
@@ -706,8 +706,8 @@  discard block
 block discarded – undo
706 706
     protected function getTransformerResponse($tags)
707 707
     {
708 708
         try {
709
-            $transFormerTags = array_filter($tags, function ($tag) {
710
-                if (! ($tag instanceof Tag)) {
709
+            $transFormerTags = array_filter($tags, function($tag) {
710
+                if (!($tag instanceof Tag)) {
711 711
                     return false;
712 712
                 }
713 713
 
@@ -718,8 +718,8 @@  discard block
 block discarded – undo
718 718
                 return false;
719 719
             }
720 720
 
721
-            $modelTag = array_first(array_filter($tags, function ($tag) {
722
-                if (! ($tag instanceof Tag)) {
721
+            $modelTag = array_first(array_filter($tags, function($tag) {
722
+                if (!($tag instanceof Tag)) {
723 723
                     return false;
724 724
                 }
725 725
 
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
             }));
728 728
             $tag = \array_first($transFormerTags);
729 729
             $transformer = $tag->getContent();
730
-            if (! \class_exists($transformer)) {
730
+            if (!\class_exists($transformer)) {
731 731
                 // if we can't find the transformer we can't generate a response
732 732
                 return;
733 733
             }
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
             if (version_compare(PHP_VERSION, '7.0.0') >= 0 && \is_null($type)) {
744 744
                 // we can only get the type with reflection for PHP 7
745 745
                 if ($parameter->hasType() &&
746
-                    ! $parameter->getType()->isBuiltin() &&
746
+                    !$parameter->getType()->isBuiltin() &&
747 747
                     \class_exists((string) $parameter->getType())) {
748 748
                     //we have a type
749 749
                     $type = (string) $parameter->getType();
Please login to merge, or discard this patch.