Completed
Pull Request — master (#323)
by
unknown
01:31
created
src/Mpociot/ApiDoc/Generators/AbstractGenerator.php 2 patches
Doc Comments   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     /**
22 22
      * @param $route
23 23
      *
24
-     * @return mixed
24
+     * @return string
25 25
      */
26 26
     abstract public function getDomain($route);
27 27
 
@@ -99,7 +99,6 @@  discard block
 block discarded – undo
99 99
     /**
100 100
      * Prepares / Disables route middlewares.
101 101
      *
102
-     * @param  bool $disable
103 102
      *
104 103
      * @return  void
105 104
      */
@@ -110,7 +109,7 @@  discard block
 block discarded – undo
110 109
      *
111 110
      * @param array $tags
112 111
      *
113
-     * @return mixed
112
+     * @return null|\Symfony\Component\HttpFoundation\Response
114 113
      */
115 114
     protected function getDocblockResponse($tags)
116 115
     {
@@ -183,7 +182,7 @@  discard block
 block discarded – undo
183 182
     }
184 183
 
185 184
     /**
186
-     * @param  $route
185
+     * @param  \Illuminate\Routing\Route $route
187 186
      * @param  $bindings
188 187
      * @param  $headers
189 188
      *
@@ -633,7 +632,7 @@  discard block
 block discarded – undo
633 632
      * @param  string  $rule
634 633
      * @param  string  $parameter
635 634
      *
636
-     * @return array
635
+     * @return string
637 636
      */
638 637
     protected function parseParameters($rule, $parameter)
639 638
     {
@@ -664,7 +663,7 @@  discard block
 block discarded – undo
664 663
     }
665 664
 
666 665
     /**
667
-     * @param $response
666
+     * @param null|\Symfony\Component\HttpFoundation\Response $response
668 667
      *
669 668
      * @return mixed
670 669
      */
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
             $response = $docblockResponse;
66 66
             $showresponse = true;
67 67
         }
68
-        if (! $response) {
68
+        if (!$response) {
69 69
             $transformerResponse = $this->getTransformerResponse($routeDescription['tags']);
70 70
             if ($transformerResponse) {
71 71
                 // we have a transformer response from the docblock ( @transformer || @transformercollection )
@@ -73,18 +73,18 @@  discard block
 block discarded – undo
73 73
                 $showresponse = true;
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
             } catch (\Exception $e) {
80
-                dump("Couldn't get response for route: ".implode(',', $this->getMethods($route)).'] '.$route->uri().'', $e->getMessage());
80
+                dump("Couldn't get response for route: " . implode(',', $this->getMethods($route)) . '] ' . $route->uri() . '', $e->getMessage());
81 81
             }
82 82
         }
83 83
 
84 84
         $content = $this->getResponseContent($response);
85 85
 
86 86
         return $this->getParameters([
87
-            'id' => md5($this->getUri($route).':'.implode($this->getMethods($route))),
87
+            'id' => md5($this->getUri($route) . ':' . implode($this->getMethods($route))),
88 88
             'resource' => $routeGroup,
89 89
             'title' => $routeDescription['short'],
90 90
             'description' => $routeDescription['long'],
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
      */
115 115
     protected function getDocblockResponse($tags)
116 116
     {
117
-        $responseTags = array_filter($tags, function ($tag) {
118
-            if (! ($tag instanceof Tag)) {
117
+        $responseTags = array_filter($tags, function($tag) {
118
+            if (!($tag instanceof Tag)) {
119 119
                 return false;
120 120
             }
121 121
 
@@ -173,9 +173,9 @@  discard block
 block discarded – undo
173 173
         }
174 174
 
175 175
         $values = collect($simplifiedRules)
176
-            ->filter(function ($values) {
176
+            ->filter(function($values) {
177 177
                 return in_array('array', $values);
178
-            })->map(function ($val, $key) {
178
+            })->map(function($val, $key) {
179 179
                 return [''];
180 180
             })->all();
181 181
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
         $methods = $this->getMethods($route);
197 197
 
198 198
         // Split headers into key - value pairs
199
-        $headers = collect($headers)->map(function ($value) {
199
+        $headers = collect($headers)->map(function($value) {
200 200
             $split = explode(':', $value); // explode to get key + values
201 201
             $key = array_shift($split); // extract the key and keep the values in the array
202 202
             $value = implode(':', $split); // implode values into string again
@@ -220,8 +220,8 @@  discard block
 block discarded – undo
220 220
     {
221 221
         $uri = $this->getUri($route);
222 222
         foreach ($bindings as $model => $id) {
223
-            $uri = str_replace('{'.$model.'}', $id, $uri);
224
-            $uri = str_replace('{'.$model.'?}', $id, $uri);
223
+            $uri = str_replace('{' . $model . '}', $id, $uri);
224
+            $uri = str_replace('{' . $model . '?}', $id, $uri);
225 225
         }
226 226
 
227 227
         return $uri;
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 
286 286
         foreach ($reflectionMethod->getParameters() as $parameter) {
287 287
             $parameterType = $parameter->getClass();
288
-            if (! is_null($parameterType) && class_exists($parameterType->name)) {
288
+            if (!is_null($parameterType) && class_exists($parameterType->name)) {
289 289
                 $className = $parameterType->name;
290 290
 
291 291
                 if (is_subclass_of($className, FormRequest::class)) {
@@ -321,8 +321,8 @@  discard block
 block discarded – undo
321 321
      */
322 322
     protected function fancyImplode($arr, $first, $last)
323 323
     {
324
-        $arr = array_map(function ($value) {
325
-            return '`'.$value.'`';
324
+        $arr = array_map(function($value) {
325
+            return '`' . $value . '`';
326 326
         }, $arr);
327 327
         array_push($arr, implode($last, array_splice($arr, -2)));
328 328
 
@@ -332,8 +332,8 @@  discard block
 block discarded – undo
332 332
     protected function splitValuePairs($parameters, $first = 'is ', $last = 'or ')
333 333
     {
334 334
         $attribute = '';
335
-        collect($parameters)->map(function ($item, $key) use (&$attribute, $first, $last) {
336
-            $attribute .= '`'.$item.'` ';
335
+        collect($parameters)->map(function($item, $key) use (&$attribute, $first, $last) {
336
+            $attribute .= '`' . $item . '` ';
337 337
             if (($key + 1) % 2 === 0) {
338 338
                 $attribute .= $last;
339 339
             } else {
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
                 }
417 417
                 break;
418 418
             case 'between':
419
-                if (! isset($attributeData['type'])) {
419
+                if (!isset($attributeData['type'])) {
420 420
                     $attributeData['type'] = 'numeric';
421 421
                 }
422 422
                 $attributeData['description'][] = Description::parse($rule)->with($parameters)->getDescription();
@@ -594,8 +594,8 @@  discard block
 block discarded – undo
594 594
         foreach ($headers as $name => $value) {
595 595
             $name = strtr(strtoupper($name), '-', '_');
596 596
 
597
-            if (! Str::startsWith($name, $prefix) && $name !== 'CONTENT_TYPE') {
598
-                $name = $prefix.$name;
597
+            if (!Str::startsWith($name, $prefix) && $name !== 'CONTENT_TYPE') {
598
+                $name = $prefix . $name;
599 599
             }
600 600
 
601 601
             $server[$name] = $value;
@@ -692,8 +692,8 @@  discard block
 block discarded – undo
692 692
     protected function getTransformerResponse($tags)
693 693
     {
694 694
         try {
695
-            $transFormerTags = array_filter($tags, function ($tag) {
696
-                if (! ($tag instanceof Tag)) {
695
+            $transFormerTags = array_filter($tags, function($tag) {
696
+                if (!($tag instanceof Tag)) {
697 697
                     return false;
698 698
                 }
699 699
 
@@ -704,8 +704,8 @@  discard block
 block discarded – undo
704 704
                 return false;
705 705
             }
706 706
 
707
-            $modelTag = array_first(array_filter($tags, function ($tag) {
708
-                if (! ($tag instanceof Tag)) {
707
+            $modelTag = array_first(array_filter($tags, function($tag) {
708
+                if (!($tag instanceof Tag)) {
709 709
                     return false;
710 710
                 }
711 711
 
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
             }));
714 714
             $tag = \array_first($transFormerTags);
715 715
             $transformer = $tag->getContent();
716
-            if (! \class_exists($transformer)) {
716
+            if (!\class_exists($transformer)) {
717 717
                 // if we can't find the transformer we can't generate a response
718 718
                 return;
719 719
             }
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
             if (version_compare(PHP_VERSION, '7.0.0') >= 0 && \is_null($type)) {
730 730
                 // we can only get the type with reflection for PHP 7
731 731
                 if ($parameter->hasType() &&
732
-                    ! $parameter->getType()->isBuiltin() &&
732
+                    !$parameter->getType()->isBuiltin() &&
733 733
                     \class_exists((string) $parameter->getType())) {
734 734
                     //we have a type
735 735
                     $type = (string) $parameter->getType();
Please login to merge, or discard this patch.
src/Mpociot/ApiDoc/Generators/LaravelGenerator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
      */
58 58
     public function prepareMiddleware($enable = true)
59 59
     {
60
-        App::instance('middleware.disable', ! $enable);
60
+        App::instance('middleware.disable', !$enable);
61 61
     }
62 62
 
63 63
     /**
Please login to merge, or discard this patch.