@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | $fractal = new Manager(); |
67 | 67 | |
68 | - if (! is_null(config('apidoc.fractal.serializer'))) { |
|
68 | + if (!is_null(config('apidoc.fractal.serializer'))) { |
|
69 | 69 | $fractal->setSerializer(app(config('apidoc.fractal.serializer'))); |
70 | 70 | } |
71 | 71 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | ], |
85 | 85 | ]; |
86 | 86 | } catch (Exception $e) { |
87 | - echo 'Exception thrown when fetching transformer response for ['.implode(',', $route->methods)."] {$route->uri}.\n"; |
|
87 | + echo 'Exception thrown when fetching transformer response for [' . implode(',', $route->methods) . "] {$route->uri}.\n"; |
|
88 | 88 | if (Flags::$shouldBeVerbose) { |
89 | 89 | Utils::dumpException($e); |
90 | 90 | } else { |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | private function getClassToBeTransformed(array $tags, ReflectionFunctionAbstract $transformerMethod): string |
122 | 122 | { |
123 | - $modelTag = Arr::first(array_filter($tags, function ($tag) { |
|
123 | + $modelTag = Arr::first(array_filter($tags, function($tag) { |
|
124 | 124 | return ($tag instanceof Tag) && strtolower($tag->getName()) == 'transformermodel'; |
125 | 125 | })); |
126 | 126 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $type = $modelTag->getContent(); |
130 | 130 | } else { |
131 | 131 | $parameter = Arr::first($transformerMethod->getParameters()); |
132 | - if ($parameter->hasType() && ! $parameter->getType()->isBuiltin() && class_exists($parameter->getType()->getName())) { |
|
132 | + if ($parameter->hasType() && !$parameter->getType()->isBuiltin() && class_exists($parameter->getType()->getName())) { |
|
133 | 133 | // Ladies and gentlemen, we have a type! |
134 | 134 | $type = $parameter->getType()->getName(); |
135 | 135 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | private function getTransformerTag(array $tags) |
191 | 191 | { |
192 | 192 | $transformerTags = array_values( |
193 | - array_filter($tags, function ($tag) { |
|
193 | + array_filter($tags, function($tag) { |
|
194 | 194 | return ($tag instanceof Tag) && in_array(strtolower($tag->getName()), ['transformer', 'transformercollection']); |
195 | 195 | }) |
196 | 196 | ); |
@@ -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 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | $class = new ReflectionClass($className); |
39 | 39 | |
40 | - if (! $class->hasMethod($methodName)) { |
|
40 | + if (!$class->hasMethod($methodName)) { |
|
41 | 41 | throw new \Exception("Error while fetching docblock for route: Class $className does not contain method $methodName"); |
42 | 42 | } |
43 | 43 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | if (is_object($classNameOrInstance)) { |
65 | 65 | // route handlers are not destroyed until the script |
66 | 66 | // ends so this should be perfectly safe. |
67 | - $classNameOrInstance = get_class($classNameOrInstance).'::'.spl_object_id($classNameOrInstance); |
|
67 | + $classNameOrInstance = get_class($classNameOrInstance) . '::' . spl_object_id($classNameOrInstance); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | return $classNameOrInstance; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $method = Utils::reflectRouteMethod([$controllerName, $methodName]); |
59 | 59 | |
60 | 60 | $parsedRoute = [ |
61 | - 'id' => md5($this->getUri($route).':'.implode($this->getMethods($route))), |
|
61 | + 'id' => md5($this->getUri($route) . ':' . implode($this->getMethods($route))), |
|
62 | 62 | 'methods' => $this->getMethods($route), |
63 | 63 | 'uri' => $this->getUri($route), |
64 | 64 | ]; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | $responses = $this->fetchResponses($controller, $method, $route, $routeRules, $parsedRoute); |
85 | 85 | $parsedRoute['responses'] = $responses; |
86 | - $parsedRoute['showresponse'] = ! empty($responses); |
|
86 | + $parsedRoute['showresponse'] = !empty($responses); |
|
87 | 87 | |
88 | 88 | return $parsedRoute; |
89 | 89 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | { |
121 | 121 | $responses = $this->iterateThroughStrategies('responses', $context, [$route, $controller, $method, $rulesToApply]); |
122 | 122 | if (count($responses)) { |
123 | - return array_filter($responses, function ($response) { |
|
123 | + return array_filter($responses, function($response) { |
|
124 | 124 | return $response['content'] != null; |
125 | 125 | }); |
126 | 126 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $strategyArgs = $arguments; |
171 | 171 | $strategyArgs[] = $context; |
172 | 172 | $results = $strategy(...$strategyArgs); |
173 | - if (! is_null($results)) { |
|
173 | + if (!is_null($results)) { |
|
174 | 174 | foreach ($results as $index => $item) { |
175 | 175 | if ($stage == 'responses') { |
176 | 176 | // Responses are additive |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | // and also allows values to be overwritten |
183 | 183 | |
184 | 184 | // Don't allow overwriting if an empty value is trying to replace a set one |
185 | - if (! in_array($context[$stage], [null, ''], true) && in_array($item, [null, ''], true)) { |
|
185 | + if (!in_array($context[$stage], [null, ''], true) && in_array($item, [null, ''], true)) { |
|
186 | 186 | continue; |
187 | 187 | } else { |
188 | 188 | $context[$stage][$index] = $item; |
@@ -207,8 +207,8 @@ discard block |
||
207 | 207 | $values = []; |
208 | 208 | |
209 | 209 | // Remove params which have no examples. |
210 | - $params = array_filter($params, function ($details) { |
|
211 | - return ! is_null($details['value']); |
|
210 | + $params = array_filter($params, function($details) { |
|
211 | + return !is_null($details['value']); |
|
212 | 212 | }); |
213 | 213 | |
214 | 214 | foreach ($params as $paramName => $details) { |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | $groupedRoutes = collect($parsedRoutes) |
72 | 72 | ->groupBy('metadata.groupName') |
73 | - ->sortBy(static function ($group) { |
|
73 | + ->sortBy(static function($group) { |
|
74 | 74 | /* @var $group Collection */ |
75 | 75 | return $group->first()['metadata']['groupName']; |
76 | 76 | }, SORT_NATURAL); |
@@ -101,18 +101,18 @@ discard block |
||
101 | 101 | $routePath = $generator->getUri($route); |
102 | 102 | |
103 | 103 | $routeControllerAndMethod = Utils::getRouteClassAndMethodNames($route->getAction()); |
104 | - if (! $this->isValidRoute($routeControllerAndMethod)) { |
|
104 | + if (!$this->isValidRoute($routeControllerAndMethod)) { |
|
105 | 105 | $this->warn(sprintf($messageFormat, 'Skipping invalid', $routeMethods, $routePath)); |
106 | 106 | continue; |
107 | 107 | } |
108 | 108 | |
109 | - if (! $this->doesControllerMethodExist($routeControllerAndMethod)) { |
|
110 | - $this->warn(sprintf($messageFormat, 'Skipping', $routeMethods, $routePath).': Controller method does not exist.'); |
|
109 | + if (!$this->doesControllerMethodExist($routeControllerAndMethod)) { |
|
110 | + $this->warn(sprintf($messageFormat, 'Skipping', $routeMethods, $routePath) . ': Controller method does not exist.'); |
|
111 | 111 | continue; |
112 | 112 | } |
113 | 113 | |
114 | - if (! $this->isRouteVisibleForDocumentation($routeControllerAndMethod)) { |
|
115 | - $this->warn(sprintf($messageFormat, 'Skipping', $routeMethods, $routePath).': @hideFromAPIDocumentation was specified.'); |
|
114 | + if (!$this->isRouteVisibleForDocumentation($routeControllerAndMethod)) { |
|
115 | + $this->warn(sprintf($messageFormat, 'Skipping', $routeMethods, $routePath) . ': @hideFromAPIDocumentation was specified.'); |
|
116 | 116 | continue; |
117 | 117 | } |
118 | 118 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $parsedRoutes[] = $generator->processRoute($route, $routeItem->getRules()); |
121 | 121 | $this->info(sprintf($messageFormat, 'Processed', $routeMethods, $routePath)); |
122 | 122 | } catch (\Exception $exception) { |
123 | - $this->warn(sprintf($messageFormat, 'Skipping', $routeMethods, $routePath).'- Exception '.get_class($exception).' encountered : '.$exception->getMessage()); |
|
123 | + $this->warn(sprintf($messageFormat, 'Skipping', $routeMethods, $routePath) . '- Exception ' . get_class($exception) . ' encountered : ' . $exception->getMessage()); |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
@@ -139,10 +139,10 @@ discard block |
||
139 | 139 | if (Utils::isInvokableObject($classOrObject)) { |
140 | 140 | return true; |
141 | 141 | } |
142 | - $routeControllerAndMethod = $classOrObject.'@'.$method; |
|
142 | + $routeControllerAndMethod = $classOrObject . '@' . $method; |
|
143 | 143 | } |
144 | 144 | |
145 | - return ! is_callable($routeControllerAndMethod) && ! is_null($routeControllerAndMethod); |
|
145 | + return !is_callable($routeControllerAndMethod) && !is_null($routeControllerAndMethod); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | /** |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | [$class, $method] = $routeControllerAndMethod; |
158 | 158 | $reflection = new ReflectionClass($class); |
159 | 159 | |
160 | - if (! $reflection->hasMethod($method)) { |
|
160 | + if (!$reflection->hasMethod($method)) { |
|
161 | 161 | return false; |
162 | 162 | } |
163 | 163 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $phpdoc = new DocBlock($comment); |
180 | 180 | |
181 | 181 | return collect($phpdoc->getTags()) |
182 | - ->filter(function ($tag) { |
|
182 | + ->filter(function($tag) { |
|
183 | 183 | return $tag->getName() === 'hideFromAPIDocumentation'; |
184 | 184 | }) |
185 | 185 | ->isEmpty(); |