@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | /** |
29 | 29 | * @param Route $route |
30 | 30 | * |
31 | - * @return mixed |
|
31 | + * @return string |
|
32 | 32 | */ |
33 | 33 | public function getUri(Route $route) |
34 | 34 | { |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * @param ReflectionMethod $method |
164 | 164 | * @param array $tags |
165 | 165 | * |
166 | - * @return array |
|
166 | + * @return Route |
|
167 | 167 | */ |
168 | 168 | protected function getQueryParameters(ReflectionMethod $method, array $tags) |
169 | 169 | { |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | ]); |
70 | 70 | |
71 | 71 | $parsedRoute = [ |
72 | - 'id' => md5($this->getUri($route).':'.implode($this->getMethods($route))), |
|
72 | + 'id' => md5($this->getUri($route) . ':' . implode($this->getMethods($route))), |
|
73 | 73 | 'groupName' => $routeGroupName, |
74 | 74 | 'groupDescription' => $routeGroupDescription, |
75 | 75 | 'title' => $routeTitle ?: $docBlock['short'], |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | 'cleanQueryParameters' => $this->cleanParams($queryParameters), |
84 | 84 | 'authenticated' => $this->getAuthStatusFromDocBlock($docBlock['tags']), |
85 | 85 | 'response' => $content, |
86 | - 'showresponse' => ! empty($content), |
|
86 | + 'showresponse' => !empty($content), |
|
87 | 87 | ]; |
88 | 88 | $parsedRoute['headers'] = $rulesToApply['headers'] ?? []; |
89 | 89 | |
@@ -129,10 +129,10 @@ discard block |
||
129 | 129 | protected function getBodyParametersFromDocBlock(array $tags) |
130 | 130 | { |
131 | 131 | $parameters = collect($tags) |
132 | - ->filter(function ($tag) { |
|
132 | + ->filter(function($tag) { |
|
133 | 133 | return $tag instanceof Tag && $tag->getName() === 'bodyParam'; |
134 | 134 | }) |
135 | - ->mapWithKeys(function ($tag) { |
|
135 | + ->mapWithKeys(function($tag) { |
|
136 | 136 | preg_match('/(.+?)\s+(.+?)\s+(required\s+)?(.*)/', $tag->getContent(), $content); |
137 | 137 | $content = preg_replace('/\s?No-example.?/', '', $content); |
138 | 138 | if (empty($content)) { |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | |
153 | 153 | $type = $this->normalizeParameterType($type); |
154 | 154 | list($description, $example) = $this->parseDescription($description, $type); |
155 | - $value = is_null($example) && ! $this->shouldExcludeExample($tag) ? $this->generateDummyValue($type) : $example; |
|
155 | + $value = is_null($example) && !$this->shouldExcludeExample($tag) ? $this->generateDummyValue($type) : $example; |
|
156 | 156 | |
157 | 157 | return [$name => compact('type', 'description', 'required', 'value')]; |
158 | 158 | })->toArray(); |
@@ -205,10 +205,10 @@ discard block |
||
205 | 205 | protected function getQueryParametersFromDocBlock(array $tags) |
206 | 206 | { |
207 | 207 | $parameters = collect($tags) |
208 | - ->filter(function ($tag) { |
|
208 | + ->filter(function($tag) { |
|
209 | 209 | return $tag instanceof Tag && $tag->getName() === 'queryParam'; |
210 | 210 | }) |
211 | - ->mapWithKeys(function ($tag) { |
|
211 | + ->mapWithKeys(function($tag) { |
|
212 | 212 | preg_match('/(.+?)\s+(required\s+)?(.*)/', $tag->getContent(), $content); |
213 | 213 | $content = preg_replace('/\s?No-example.?/', '', $content); |
214 | 214 | if (empty($content)) { |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | } |
228 | 228 | |
229 | 229 | list($description, $value) = $this->parseDescription($description, 'string'); |
230 | - if (is_null($value) && ! $this->shouldExcludeExample($tag)) { |
|
230 | + if (is_null($value) && !$this->shouldExcludeExample($tag)) { |
|
231 | 231 | $value = Str::contains($description, ['number', 'count', 'page']) |
232 | 232 | ? $this->generateDummyValue('integer') |
233 | 233 | : $this->generateDummyValue('string'); |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | protected function getAuthStatusFromDocBlock(array $tags) |
248 | 248 | { |
249 | 249 | $authTag = collect($tags) |
250 | - ->first(function ($tag) { |
|
250 | + ->first(function($tag) { |
|
251 | 251 | return $tag instanceof Tag && strtolower($tag->getName()) === 'authenticated'; |
252 | 252 | }); |
253 | 253 | |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | protected function getRouteGroup(ReflectionClass $controller, array $methodDocBlock) |
281 | 281 | { |
282 | 282 | // @group tag on the method overrides that on the controller |
283 | - if (! empty($methodDocBlock['tags'])) { |
|
283 | + if (!empty($methodDocBlock['tags'])) { |
|
284 | 284 | foreach ($methodDocBlock['tags'] as $tag) { |
285 | 285 | if ($tag->getName() === 'group') { |
286 | 286 | $routeGroupParts = explode("\n", trim($tag->getContent())); |
@@ -347,25 +347,25 @@ discard block |
||
347 | 347 | $faker->seed($this->config->get('faker_seed')); |
348 | 348 | } |
349 | 349 | $fakeFactories = [ |
350 | - 'integer' => function () use ($faker) { |
|
350 | + 'integer' => function() use ($faker) { |
|
351 | 351 | return $faker->numberBetween(1, 20); |
352 | 352 | }, |
353 | - 'number' => function () use ($faker) { |
|
353 | + 'number' => function() use ($faker) { |
|
354 | 354 | return $faker->randomFloat(); |
355 | 355 | }, |
356 | - 'float' => function () use ($faker) { |
|
356 | + 'float' => function() use ($faker) { |
|
357 | 357 | return $faker->randomFloat(); |
358 | 358 | }, |
359 | - 'boolean' => function () use ($faker) { |
|
359 | + 'boolean' => function() use ($faker) { |
|
360 | 360 | return $faker->boolean(); |
361 | 361 | }, |
362 | - 'string' => function () use ($faker) { |
|
362 | + 'string' => function() use ($faker) { |
|
363 | 363 | return $faker->word; |
364 | 364 | }, |
365 | - 'array' => function () { |
|
365 | + 'array' => function() { |
|
366 | 366 | return []; |
367 | 367 | }, |
368 | - 'object' => function () { |
|
368 | + 'object' => function() { |
|
369 | 369 | return new \stdClass; |
370 | 370 | }, |
371 | 371 | ]; |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | // for each ruleset in the config file. Not a high priority, though. |
55 | 55 | private function getAllRoutes(bool $usingDingoRouter, array $versions = []) |
56 | 56 | { |
57 | - if (! $usingDingoRouter) { |
|
57 | + if (!$usingDingoRouter) { |
|
58 | 58 | return RouteFacade::getRoutes(); |
59 | 59 | } |
60 | 60 | |
61 | 61 | $allRouteCollections = app(\Dingo\Api\Routing\Router::class)->getRoutes(); |
62 | 62 | |
63 | 63 | return collect($allRouteCollections) |
64 | - ->flatMap(function (RouteCollection $collection) { |
|
64 | + ->flatMap(function(RouteCollection $collection) { |
|
65 | 65 | return $collection->getRoutes(); |
66 | 66 | })->toArray(); |
67 | 67 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | private function shouldIncludeRoute(Route $route, array $routeRule, array $mustIncludes, bool $usingDingoRouter) |
70 | 70 | { |
71 | 71 | $matchesVersion = $usingDingoRouter |
72 | - ? ! empty(array_intersect($route->versions(), $routeRule['match']['versions'] ?? [])) |
|
72 | + ? !empty(array_intersect($route->versions(), $routeRule['match']['versions'] ?? [])) |
|
73 | 73 | : true; |
74 | 74 | |
75 | 75 | return Str::is($mustIncludes, $route->getName()) |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | $fractal = new Manager(); |
51 | 51 | |
52 | - if (! is_null(config('apidoc.fractal.serializer'))) { |
|
52 | + if (!is_null(config('apidoc.fractal.serializer'))) { |
|
53 | 53 | $fractal->setSerializer(app(config('apidoc.fractal.serializer'))); |
54 | 54 | } |
55 | 55 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | private function getClassToBeTransformed(array $tags, ReflectionMethod $transformerMethod) |
83 | 83 | { |
84 | - $modelTag = Arr::first(array_filter($tags, function ($tag) { |
|
84 | + $modelTag = Arr::first(array_filter($tags, function($tag) { |
|
85 | 85 | return ($tag instanceof Tag) && strtolower($tag->getName()) == 'transformermodel'; |
86 | 86 | })); |
87 | 87 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $type = $modelTag->getContent(); |
91 | 91 | } else { |
92 | 92 | $parameter = Arr::first($transformerMethod->getParameters()); |
93 | - if ($parameter->hasType() && ! $parameter->getType()->isBuiltin() && class_exists((string) $parameter->getType())) { |
|
93 | + if ($parameter->hasType() && !$parameter->getType()->isBuiltin() && class_exists((string) $parameter->getType())) { |
|
94 | 94 | // ladies and gentlemen, we have a type! |
95 | 95 | $type = (string) $parameter->getType(); |
96 | 96 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | private function getTransformerTag(array $tags) |
143 | 143 | { |
144 | 144 | $transFormerTags = array_values( |
145 | - array_filter($tags, function ($tag) { |
|
145 | + array_filter($tags, function($tag) { |
|
146 | 146 | return ($tag instanceof Tag) && in_array(strtolower($tag->getName()), ['transformer', 'transformercollection']); |
147 | 147 | }) |
148 | 148 | ); |