@@ -75,7 +75,7 @@ discard block |
||
| 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,25 +83,25 @@ discard block |
||
| 83 | 83 | $showresponse = true; |
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | - if (! $response && $withResponse) { |
|
| 86 | + if (!$response && $withResponse) { |
|
| 87 | 87 | try { |
| 88 | 88 | // we have a queryParameters array from the docblock |
| 89 | 89 | $parameters = $this->getQueryParameters($routeDescription['tags']); |
| 90 | 90 | |
| 91 | - if(!is_array($parameters)) { |
|
| 91 | + if (!is_array($parameters)) { |
|
| 92 | 92 | $parameters = []; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | $response = $this->getRouteResponse($route, $bindings, $parameters, $headers); |
| 96 | 96 | } catch (\Exception $e) { |
| 97 | - echo "Couldn't get response for route: ".implode(',', $this->getMethods($route)).$route->uri().']: '.$e->getMessage()."\n"; |
|
| 97 | + echo "Couldn't get response for route: " . implode(',', $this->getMethods($route)) . $route->uri() . ']: ' . $e->getMessage() . "\n"; |
|
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | $content = $this->getResponseContent($response); |
| 102 | 102 | |
| 103 | 103 | return $this->getParameters([ |
| 104 | - 'id' => md5($this->getUri($route).':'.implode($this->getMethods($route))), |
|
| 104 | + 'id' => md5($this->getUri($route) . ':' . implode($this->getMethods($route))), |
|
| 105 | 105 | 'resource' => $routeGroup, |
| 106 | 106 | 'title' => $routeDescription['short'], |
| 107 | 107 | 'description' => $routeDescription['long'], |
@@ -131,8 +131,8 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | protected function getDocblockResponse($tags) |
| 133 | 133 | { |
| 134 | - $responseTags = array_filter($tags, function ($tag) { |
|
| 135 | - if (! ($tag instanceof Tag)) { |
|
| 134 | + $responseTags = array_filter($tags, function($tag) { |
|
| 135 | + if (!($tag instanceof Tag)) { |
|
| 136 | 136 | return false; |
| 137 | 137 | } |
| 138 | 138 | |
@@ -194,9 +194,9 @@ discard block |
||
| 194 | 194 | // Laravel will ignore the nested array rules unless the key referenced exists and is an array |
| 195 | 195 | // So we'll to create an empty array for each array attribute |
| 196 | 196 | $values = collect($rules) |
| 197 | - ->filter(function ($values) { |
|
| 197 | + ->filter(function($values) { |
|
| 198 | 198 | return in_array('array', $values); |
| 199 | - })->map(function ($val, $key) { |
|
| 199 | + })->map(function($val, $key) { |
|
| 200 | 200 | return ['']; |
| 201 | 201 | })->all(); |
| 202 | 202 | |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | $methods = $this->getMethods($route); |
| 220 | 220 | |
| 221 | 221 | // Split headers into key - value pairs |
| 222 | - $headers = collect($headers)->map(function ($value) { |
|
| 222 | + $headers = collect($headers)->map(function($value) { |
|
| 223 | 223 | $split = explode(':', $value); // explode to get key + values |
| 224 | 224 | $key = array_shift($split); // extract the key and keep the values in the array |
| 225 | 225 | $value = implode(':', $split); // implode values into string again |
@@ -242,8 +242,8 @@ discard block |
||
| 242 | 242 | */ |
| 243 | 243 | protected function getQueryParameters($tags) |
| 244 | 244 | { |
| 245 | - $responseTags = array_filter($tags, function ($tag) { |
|
| 246 | - if (! ($tag instanceof Tag)) { |
|
| 245 | + $responseTags = array_filter($tags, function($tag) { |
|
| 246 | + if (!($tag instanceof Tag)) { |
|
| 247 | 247 | return false; |
| 248 | 248 | } |
| 249 | 249 | |
@@ -269,8 +269,8 @@ discard block |
||
| 269 | 269 | { |
| 270 | 270 | $uri = $this->getUri($route); |
| 271 | 271 | foreach ($bindings as $model => $id) { |
| 272 | - $uri = str_replace('{'.$model.'}', $id, $uri); |
|
| 273 | - $uri = str_replace('{'.$model.'?}', $id, $uri); |
|
| 272 | + $uri = str_replace('{' . $model . '}', $id, $uri); |
|
| 273 | + $uri = str_replace('{' . $model . '?}', $id, $uri); |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | return $uri; |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | |
| 335 | 335 | foreach ($reflectionMethod->getParameters() as $parameter) { |
| 336 | 336 | $parameterType = $parameter->getClass(); |
| 337 | - if (! is_null($parameterType) && class_exists($parameterType->name)) { |
|
| 337 | + if (!is_null($parameterType) && class_exists($parameterType->name)) { |
|
| 338 | 338 | $className = $parameterType->name; |
| 339 | 339 | |
| 340 | 340 | if (is_subclass_of($className, FormRequest::class)) { |
@@ -370,8 +370,8 @@ discard block |
||
| 370 | 370 | */ |
| 371 | 371 | protected function fancyImplode($arr, $first, $last) |
| 372 | 372 | { |
| 373 | - $arr = array_map(function ($value) { |
|
| 374 | - return '`'.$value.'`'; |
|
| 373 | + $arr = array_map(function($value) { |
|
| 374 | + return '`' . $value . '`'; |
|
| 375 | 375 | }, $arr); |
| 376 | 376 | array_push($arr, implode($last, array_splice($arr, -2))); |
| 377 | 377 | |
@@ -381,8 +381,8 @@ discard block |
||
| 381 | 381 | protected function splitValuePairs($parameters, $first = 'is ', $last = 'or ') |
| 382 | 382 | { |
| 383 | 383 | $attribute = ''; |
| 384 | - collect($parameters)->map(function ($item, $key) use (&$attribute, $first, $last) { |
|
| 385 | - $attribute .= '`'.$item.'` '; |
|
| 384 | + collect($parameters)->map(function($item, $key) use (&$attribute, $first, $last) { |
|
| 385 | + $attribute .= '`' . $item . '` '; |
|
| 386 | 386 | if (($key + 1) % 2 === 0) { |
| 387 | 387 | $attribute .= $last; |
| 388 | 388 | } else { |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | } |
| 466 | 466 | break; |
| 467 | 467 | case 'between': |
| 468 | - if (! isset($attributeData['type'])) { |
|
| 468 | + if (!isset($attributeData['type'])) { |
|
| 469 | 469 | $attributeData['type'] = 'numeric'; |
| 470 | 470 | } |
| 471 | 471 | $attributeData['description'][] = Description::parse($rule)->with($parameters)->getDescription(); |
@@ -643,8 +643,8 @@ discard block |
||
| 643 | 643 | foreach ($headers as $name => $value) { |
| 644 | 644 | $name = strtr(strtoupper($name), '-', '_'); |
| 645 | 645 | |
| 646 | - if (! Str::startsWith($name, $prefix) && $name !== 'CONTENT_TYPE') { |
|
| 647 | - $name = $prefix.$name; |
|
| 646 | + if (!Str::startsWith($name, $prefix) && $name !== 'CONTENT_TYPE') { |
|
| 647 | + $name = $prefix . $name; |
|
| 648 | 648 | } |
| 649 | 649 | |
| 650 | 650 | $server[$name] = $value; |
@@ -741,8 +741,8 @@ discard block |
||
| 741 | 741 | protected function getTransformerResponse($tags) |
| 742 | 742 | { |
| 743 | 743 | try { |
| 744 | - $transFormerTags = array_filter($tags, function ($tag) { |
|
| 745 | - if (! ($tag instanceof Tag)) { |
|
| 744 | + $transFormerTags = array_filter($tags, function($tag) { |
|
| 745 | + if (!($tag instanceof Tag)) { |
|
| 746 | 746 | return false; |
| 747 | 747 | } |
| 748 | 748 | |
@@ -753,8 +753,8 @@ discard block |
||
| 753 | 753 | return false; |
| 754 | 754 | } |
| 755 | 755 | |
| 756 | - $modelTag = array_first(array_filter($tags, function ($tag) { |
|
| 757 | - if (! ($tag instanceof Tag)) { |
|
| 756 | + $modelTag = array_first(array_filter($tags, function($tag) { |
|
| 757 | + if (!($tag instanceof Tag)) { |
|
| 758 | 758 | return false; |
| 759 | 759 | } |
| 760 | 760 | |
@@ -762,7 +762,7 @@ discard block |
||
| 762 | 762 | })); |
| 763 | 763 | $tag = \array_first($transFormerTags); |
| 764 | 764 | $transformer = $tag->getContent(); |
| 765 | - if (! \class_exists($transformer)) { |
|
| 765 | + if (!\class_exists($transformer)) { |
|
| 766 | 766 | // if we can't find the transformer we can't generate a response |
| 767 | 767 | return; |
| 768 | 768 | } |
@@ -778,7 +778,7 @@ discard block |
||
| 778 | 778 | if (version_compare(PHP_VERSION, '7.0.0') >= 0 && \is_null($type)) { |
| 779 | 779 | // we can only get the type with reflection for PHP 7 |
| 780 | 780 | if ($parameter->hasType() && |
| 781 | - ! $parameter->getType()->isBuiltin() && |
|
| 781 | + !$parameter->getType()->isBuiltin() && |
|
| 782 | 782 | \class_exists((string) $parameter->getType())) { |
| 783 | 783 | //we have a type |
| 784 | 784 | $type = (string) $parameter->getType(); |