@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | public function __invoke(Route $route, \ReflectionClass $controller, \ReflectionFunctionAbstract $method, array $routeRules, array $context = []) |
32 | 32 | { |
33 | 33 | $rulesToApply = $routeRules['response_calls'] ?? []; |
34 | - if (! $this->shouldMakeApiCall($route, $rulesToApply, $context)) { |
|
34 | + if (!$this->shouldMakeApiCall($route, $rulesToApply, $context)) { |
|
35 | 35 | return null; |
36 | 36 | } |
37 | 37 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | ], |
53 | 53 | ]; |
54 | 54 | } catch (\Exception $e) { |
55 | - echo 'Exception thrown during response call for ['.implode(',', $route->methods)."] {$route->uri}.\n"; |
|
55 | + echo 'Exception thrown during response call for [' . implode(',', $route->methods) . "] {$route->uri}.\n"; |
|
56 | 56 | if (Flags::$shouldBeVerbose) { |
57 | 57 | Utils::dumpException($e); |
58 | 58 | } else { |
@@ -194,14 +194,14 @@ discard block |
||
194 | 194 | // set URL and query parameters |
195 | 195 | $uri = $request->getRequestUri(); |
196 | 196 | $query = $request->getQueryString(); |
197 | - if (! empty($query)) { |
|
197 | + if (!empty($query)) { |
|
198 | 198 | $uri .= "?$query"; |
199 | 199 | } |
200 | 200 | $response = call_user_func_array([$dispatcher, strtolower($request->method())], [$uri]); |
201 | 201 | |
202 | 202 | // the response from the Dingo dispatcher is the 'raw' response from the controller, |
203 | 203 | // so we have to ensure it's JSON first |
204 | - if (! $response instanceof Response) { |
|
204 | + if (!$response instanceof Response) { |
|
205 | 205 | $response = response()->json($response); |
206 | 206 | } |
207 | 207 | |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | } |
330 | 330 | |
331 | 331 | // Don't attempt a response call if there are already successful responses |
332 | - $successResponses = collect($context['responses'])->filter(function ($response) { |
|
332 | + $successResponses = collect($context['responses'])->filter(function($response) { |
|
333 | 333 | return ((string) $response['status'])[0] == '2'; |
334 | 334 | })->count(); |
335 | 335 | if ($successResponses) { |
@@ -365,8 +365,8 @@ discard block |
||
365 | 365 | $prefix = 'HTTP_'; |
366 | 366 | foreach ($headers as $name => $value) { |
367 | 367 | $name = strtr(strtoupper($name), '-', '_'); |
368 | - if (! Str::startsWith($name, $prefix) && $name !== 'CONTENT_TYPE') { |
|
369 | - $name = $prefix.$name; |
|
368 | + if (!Str::startsWith($name, $prefix) && $name !== 'CONTENT_TYPE') { |
|
369 | + $name = $prefix . $name; |
|
370 | 370 | } |
371 | 371 | $server[$name] = $value; |
372 | 372 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | : $controller->getMethod($methodName); |
62 | 62 | |
63 | 63 | $parsedRoute = [ |
64 | - 'id' => md5($this->getUri($route).':'.implode($this->getMethods($route))), |
|
64 | + 'id' => md5($this->getUri($route) . ':' . implode($this->getMethods($route))), |
|
65 | 65 | 'methods' => $this->getMethods($route), |
66 | 66 | 'uri' => $this->getUri($route), |
67 | 67 | ]; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | $responses = $this->fetchResponses($controller, $method, $route, $routeRules, $parsedRoute); |
88 | 88 | $parsedRoute['responses'] = $responses; |
89 | - $parsedRoute['showresponse'] = ! empty($responses); |
|
89 | + $parsedRoute['showresponse'] = !empty($responses); |
|
90 | 90 | |
91 | 91 | return $parsedRoute; |
92 | 92 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | { |
124 | 124 | $responses = $this->iterateThroughStrategies('responses', $context, [$route, $controller, $method, $rulesToApply]); |
125 | 125 | if (count($responses)) { |
126 | - return array_filter($responses, function ($response) { |
|
126 | + return array_filter($responses, function($response) { |
|
127 | 127 | return $response['content'] != null; |
128 | 128 | }); |
129 | 129 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | $strategyArgs = $arguments; |
174 | 174 | $strategyArgs[] = $context; |
175 | 175 | $results = $strategy(...$strategyArgs); |
176 | - if (! is_null($results)) { |
|
176 | + if (!is_null($results)) { |
|
177 | 177 | foreach ($results as $index => $item) { |
178 | 178 | if ($stage == 'responses') { |
179 | 179 | // Responses are additive |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | // and also allows values to be overwritten |
186 | 186 | |
187 | 187 | // Don't allow overwriting if an empty value is trying to replace a set one |
188 | - if (! in_array($context[$stage], [null, ''], true) && in_array($item, [null, ''], true)) { |
|
188 | + if (!in_array($context[$stage], [null, ''], true) && in_array($item, [null, ''], true)) { |
|
189 | 189 | continue; |
190 | 190 | } else { |
191 | 191 | $context[$stage][$index] = $item; |
@@ -210,8 +210,8 @@ discard block |
||
210 | 210 | $values = []; |
211 | 211 | |
212 | 212 | // Remove params which have no examples. |
213 | - $params = array_filter($params, function ($details) { |
|
214 | - return ! is_null($details['value']); |
|
213 | + $params = array_filter($params, function($details) { |
|
214 | + return !is_null($details['value']); |
|
215 | 215 | }); |
216 | 216 | |
217 | 217 | foreach ($params as $paramName => $details) { |