@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | protected function getDocBlockResponses(array $tags) |
| 34 | 34 | { |
| 35 | 35 | $responseTags = array_values( |
| 36 | - array_filter($tags, function ($tag) { |
|
| 36 | + array_filter($tags, function($tag) { |
|
| 37 | 37 | return $tag instanceof Tag && strtolower($tag->getName()) === 'response'; |
| 38 | 38 | }) |
| 39 | 39 | ); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | return; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - return array_map(function (Tag $responseTag) { |
|
| 45 | + return array_map(function(Tag $responseTag) { |
|
| 46 | 46 | preg_match('/^(\d{3})?\s?([\s\S]*)$/', $responseTag->getContent(), $result); |
| 47 | 47 | |
| 48 | 48 | $status = $result[1] ?: 200; |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | public function __invoke(Route $route, array $tags, array $routeProps) |
| 28 | 28 | { |
| 29 | 29 | $rulesToApply = $routeProps['rules']['response_calls'] ?? []; |
| 30 | - if (! $this->shouldMakeApiCall($route, $rulesToApply)) { |
|
| 30 | + if (!$this->shouldMakeApiCall($route, $rulesToApply)) { |
|
| 31 | 31 | return; |
| 32 | 32 | } |
| 33 | 33 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | try { |
| 38 | 38 | $response = [$this->makeApiCall($request)]; |
| 39 | 39 | } catch (\Exception $e) { |
| 40 | - echo 'Exception thrown during response call for ['.implode(',', $route->methods)."] {$route->uri}.\n"; |
|
| 40 | + echo 'Exception thrown during response call for [' . implode(',', $route->methods) . "] {$route->uri}.\n"; |
|
| 41 | 41 | if (Flags::$shouldBeVerbose) { |
| 42 | 42 | Utils::dumpException($e); |
| 43 | 43 | } else { |
@@ -174,14 +174,14 @@ discard block |
||
| 174 | 174 | // set URL and query parameters |
| 175 | 175 | $uri = $request->getRequestUri(); |
| 176 | 176 | $query = $request->getQueryString(); |
| 177 | - if (! empty($query)) { |
|
| 177 | + if (!empty($query)) { |
|
| 178 | 178 | $uri .= "?$query"; |
| 179 | 179 | } |
| 180 | 180 | $response = call_user_func_array([$dispatcher, strtolower($request->method())], [$uri]); |
| 181 | 181 | |
| 182 | 182 | // the response from the Dingo dispatcher is the 'raw' response from the controller, |
| 183 | 183 | // so we have to ensure it's JSON first |
| 184 | - if (! $response instanceof Response) { |
|
| 184 | + if (!$response instanceof Response) { |
|
| 185 | 185 | $response = response()->json($response); |
| 186 | 186 | } |
| 187 | 187 | |
@@ -330,8 +330,8 @@ discard block |
||
| 330 | 330 | $prefix = 'HTTP_'; |
| 331 | 331 | foreach ($headers as $name => $value) { |
| 332 | 332 | $name = strtr(strtoupper($name), '-', '_'); |
| 333 | - if (! starts_with($name, $prefix) && $name !== 'CONTENT_TYPE') { |
|
| 334 | - $name = $prefix.$name; |
|
| 333 | + if (!starts_with($name, $prefix) && $name !== 'CONTENT_TYPE') { |
|
| 334 | + $name = $prefix . $name; |
|
| 335 | 335 | } |
| 336 | 336 | $server[$name] = $value; |
| 337 | 337 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | { |
| 35 | 35 | // Avoid "holes" in the keys of the filtered array, by using array_values on the filtered array |
| 36 | 36 | $responseFileTags = array_values( |
| 37 | - array_filter($tags, function ($tag) { |
|
| 37 | + array_filter($tags, function($tag) { |
|
| 38 | 38 | return $tag instanceof Tag && strtolower($tag->getName()) === 'responsefile'; |
| 39 | 39 | }) |
| 40 | 40 | ); |
@@ -43,11 +43,11 @@ discard block |
||
| 43 | 43 | return; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - return array_map(function (Tag $responseFileTag) { |
|
| 46 | + return array_map(function(Tag $responseFileTag) { |
|
| 47 | 47 | preg_match('/^(\d{3})?\s?([\S]*[\s]*?)(\{.*\})?$/', $responseFileTag->getContent(), $result); |
| 48 | 48 | $status = $result[1] ?: 200; |
| 49 | 49 | $content = $result[2] ? file_get_contents(storage_path(trim($result[2])), true) : '{}'; |
| 50 | - $json = ! empty($result[3]) ? str_replace("'", '"', $result[3]) : '{}'; |
|
| 50 | + $json = !empty($result[3]) ? str_replace("'", '"', $result[3]) : '{}'; |
|
| 51 | 51 | $merged = array_merge(json_decode($content, true), json_decode($json, true)); |
| 52 | 52 | |
| 53 | 53 | return new JsonResponse($merged, (int) $status); |