@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | /** |
| 19 | 19 | * @param $route |
| 20 | 20 | * |
| 21 | - * @return mixed |
|
| 21 | + * @return string |
|
| 22 | 22 | */ |
| 23 | 23 | abstract public function getDomain($route); |
| 24 | 24 | |
@@ -102,7 +102,6 @@ discard block |
||
| 102 | 102 | /** |
| 103 | 103 | * Prepares / Disables route middlewares. |
| 104 | 104 | * |
| 105 | - * @param bool $disable |
|
| 106 | 105 | * |
| 107 | 106 | * @return void |
| 108 | 107 | */ |
@@ -113,7 +112,7 @@ discard block |
||
| 113 | 112 | * |
| 114 | 113 | * @param array $tags |
| 115 | 114 | * |
| 116 | - * @return mixed |
|
| 115 | + * @return null|\Symfony\Component\HttpFoundation\Response |
|
| 117 | 116 | */ |
| 118 | 117 | protected function getDocblockResponse($tags) |
| 119 | 118 | { |
@@ -186,7 +185,7 @@ discard block |
||
| 186 | 185 | } |
| 187 | 186 | |
| 188 | 187 | /** |
| 189 | - * @param $route |
|
| 188 | + * @param \Illuminate\Routing\Route $route |
|
| 190 | 189 | * @param $bindings |
| 191 | 190 | * @param $headers |
| 192 | 191 | * |
@@ -617,7 +616,7 @@ discard block |
||
| 617 | 616 | * @param string $rule |
| 618 | 617 | * @param string $parameter |
| 619 | 618 | * |
| 620 | - * @return array |
|
| 619 | + * @return string |
|
| 621 | 620 | */ |
| 622 | 621 | protected function parseParameters($rule, $parameter) |
| 623 | 622 | { |
@@ -64,7 +64,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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; |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | /** |
| 18 | 18 | * @param Route $route |
| 19 | 19 | * |
| 20 | - * @return mixed |
|
| 20 | + * @return string|null |
|
| 21 | 21 | */ |
| 22 | 22 | public function getDomain($route) |
| 23 | 23 | { |
@@ -57,7 +57,6 @@ discard block |
||
| 57 | 57 | /** |
| 58 | 58 | * Prepares / Disables route middlewares. |
| 59 | 59 | * |
| 60 | - * @param bool $disable |
|
| 61 | 60 | * |
| 62 | 61 | * @return void |
| 63 | 62 | */ |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public function prepareMiddleware($enable = true) |
| 65 | 65 | { |
| 66 | - App::instance('middleware.disable', ! $enable); |
|
| 66 | + App::instance('middleware.disable', !$enable); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -109,8 +109,8 @@ discard block |
||
| 109 | 109 | protected function getTransformerResponse($tags) |
| 110 | 110 | { |
| 111 | 111 | try { |
| 112 | - $transFormerTags = array_filter($tags, function ($tag) { |
|
| 113 | - if (! ($tag instanceof Tag)) { |
|
| 112 | + $transFormerTags = array_filter($tags, function($tag) { |
|
| 113 | + if (!($tag instanceof Tag)) { |
|
| 114 | 114 | return false; |
| 115 | 115 | } |
| 116 | 116 | |
@@ -121,8 +121,8 @@ discard block |
||
| 121 | 121 | return false; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - $modelTag = array_first(array_filter($tags, function ($tag) { |
|
| 125 | - if (! ($tag instanceof Tag)) { |
|
| 124 | + $modelTag = array_first(array_filter($tags, function($tag) { |
|
| 125 | + if (!($tag instanceof Tag)) { |
|
| 126 | 126 | return false; |
| 127 | 127 | } |
| 128 | 128 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | })); |
| 131 | 131 | $tag = \array_first($transFormerTags); |
| 132 | 132 | $transformer = $tag->getContent(); |
| 133 | - if (! \class_exists($transformer)) { |
|
| 133 | + if (!\class_exists($transformer)) { |
|
| 134 | 134 | // if we can't find the transformer we can't generate a response |
| 135 | 135 | return; |
| 136 | 136 | } |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | if (version_compare(PHP_VERSION, '7.0.0') >= 0 && \is_null($type)) { |
| 147 | 147 | // we can only get the type with reflection for PHP 7 |
| 148 | 148 | if ($parameter->hasType() && |
| 149 | - ! $parameter->getType()->isBuiltin() && |
|
| 149 | + !$parameter->getType()->isBuiltin() && |
|
| 150 | 150 | \class_exists((string) $parameter->getType())) { |
| 151 | 151 | //we have a type |
| 152 | 152 | $type = (string) $parameter->getType(); |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | { |
| 26 | 26 | $dispatcher = app('Dingo\Api\Dispatcher')->raw(); |
| 27 | 27 | |
| 28 | - collect($server)->map(function ($key, $value) use ($dispatcher) { |
|
| 28 | + collect($server)->map(function($key, $value) use ($dispatcher) { |
|
| 29 | 29 | $dispatcher->header($value, $key); |
| 30 | 30 | }); |
| 31 | 31 | |