@@ -77,7 +77,7 @@ |
||
77 | 77 | * |
78 | 78 | * @param string $type |
79 | 79 | * |
80 | - * @return mixed|string |
|
80 | + * @return string |
|
81 | 81 | */ |
82 | 82 | protected function normalizeParameterType(string $type) |
83 | 83 | { |
@@ -14,25 +14,25 @@ |
||
14 | 14 | $faker->seed($this->config->get('faker_seed')); |
15 | 15 | } |
16 | 16 | $fakeFactories = [ |
17 | - 'integer' => function () use ($faker) { |
|
17 | + 'integer' => function() use ($faker) { |
|
18 | 18 | return $faker->numberBetween(1, 20); |
19 | 19 | }, |
20 | - 'number' => function () use ($faker) { |
|
20 | + 'number' => function() use ($faker) { |
|
21 | 21 | return $faker->randomFloat(); |
22 | 22 | }, |
23 | - 'float' => function () use ($faker) { |
|
23 | + 'float' => function() use ($faker) { |
|
24 | 24 | return $faker->randomFloat(); |
25 | 25 | }, |
26 | - 'boolean' => function () use ($faker) { |
|
26 | + 'boolean' => function() use ($faker) { |
|
27 | 27 | return $faker->boolean(); |
28 | 28 | }, |
29 | - 'string' => function () use ($faker) { |
|
29 | + 'string' => function() use ($faker) { |
|
30 | 30 | return $faker->word; |
31 | 31 | }, |
32 | - 'array' => function () { |
|
32 | + 'array' => function() { |
|
33 | 33 | return []; |
34 | 34 | }, |
35 | - 'object' => function () { |
|
35 | + 'object' => function() { |
|
36 | 36 | return new stdClass(); |
37 | 37 | }, |
38 | 38 | ]; |
@@ -64,14 +64,14 @@ discard block |
||
64 | 64 | |
65 | 65 | private function getAllRoutes(bool $usingDingoRouter) |
66 | 66 | { |
67 | - if (! $usingDingoRouter) { |
|
67 | + if (!$usingDingoRouter) { |
|
68 | 68 | return RouteFacade::getRoutes(); |
69 | 69 | } |
70 | 70 | |
71 | 71 | $allRouteCollections = app(\Dingo\Api\Routing\Router::class)->getRoutes(); |
72 | 72 | |
73 | 73 | return collect($allRouteCollections) |
74 | - ->flatMap(function (RouteCollection $collection) { |
|
74 | + ->flatMap(function(RouteCollection $collection) { |
|
75 | 75 | return $collection->getRoutes(); |
76 | 76 | })->toArray(); |
77 | 77 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | private function shouldIncludeRoute(Route $route, array $routeRule, array $mustIncludes, bool $usingDingoRouter) |
80 | 80 | { |
81 | 81 | $matchesVersion = $usingDingoRouter |
82 | - ? ! empty(array_intersect($route->versions(), $routeRule['match']['versions'] ?? [])) |
|
82 | + ? !empty(array_intersect($route->versions(), $routeRule['match']['versions'] ?? [])) |
|
83 | 83 | : true; |
84 | 84 | |
85 | 85 | return Str::is($mustIncludes, $route->getName()) |
@@ -20,7 +20,7 @@ |
||
20 | 20 | |
21 | 21 | $class = new ReflectionClass($className); |
22 | 22 | |
23 | - if (! $class->hasMethod($methodName)) { |
|
23 | + if (!$class->hasMethod($methodName)) { |
|
24 | 24 | throw new \Exception("Error while fetching docblock for route: Class $className does not contain method $methodName"); |
25 | 25 | } |
26 | 26 |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | protected function getDocBlockResponses(array $tags) |
44 | 44 | { |
45 | 45 | $responseTags = array_values( |
46 | - array_filter($tags, function ($tag) { |
|
46 | + array_filter($tags, function($tag) { |
|
47 | 47 | return $tag instanceof Tag && strtolower($tag->getName()) === 'response'; |
48 | 48 | }) |
49 | 49 | ); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | return null; |
53 | 53 | } |
54 | 54 | |
55 | - $responses = array_map(function (Tag $responseTag) { |
|
55 | + $responses = array_map(function(Tag $responseTag) { |
|
56 | 56 | preg_match('/^(\d{3})?\s?([\s\S]*)$/', $responseTag->getContent(), $result); |
57 | 57 | |
58 | 58 | $status = $result[1] ?: 200; |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | private function getUrlParametersFromDocBlock($tags) |
56 | 56 | { |
57 | 57 | $parameters = collect($tags) |
58 | - ->filter(function ($tag) { |
|
58 | + ->filter(function($tag) { |
|
59 | 59 | return $tag instanceof Tag && $tag->getName() === 'urlParam'; |
60 | 60 | }) |
61 | - ->mapWithKeys(function (Tag $tag) { |
|
61 | + ->mapWithKeys(function(Tag $tag) { |
|
62 | 62 | // Format: |
63 | 63 | // @urlParam <name> <"required" (optional)> <description> |
64 | 64 | // Examples: |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | list($description, $value) = $this->parseParamDescription($description, 'string'); |
85 | - if (is_null($value) && ! $this->shouldExcludeExample($tag->getContent())) { |
|
85 | + if (is_null($value) && !$this->shouldExcludeExample($tag->getContent())) { |
|
86 | 86 | $value = Str::contains($description, ['number', 'count', 'page']) |
87 | 87 | ? $this->generateDummyValue('integer') |
88 | 88 | : $this->generateDummyValue('string'); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | protected function getAuthStatusFromDocBlock(array $tags) |
38 | 38 | { |
39 | 39 | $authTag = collect($tags) |
40 | - ->first(function ($tag) { |
|
40 | + ->first(function($tag) { |
|
41 | 41 | return $tag instanceof Tag && strtolower($tag->getName()) === 'authenticated'; |
42 | 42 | }); |
43 | 43 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | protected function getRouteGroupDescriptionAndTitle(DocBlock $methodDocBlock, DocBlock $controllerDocBlock) |
54 | 54 | { |
55 | 55 | // @group tag on the method overrides that on the controller |
56 | - if (! empty($methodDocBlock->getTags())) { |
|
56 | + if (!empty($methodDocBlock->getTags())) { |
|
57 | 57 | foreach ($methodDocBlock->getTags() as $tag) { |
58 | 58 | if ($tag->getName() === 'group') { |
59 | 59 | $routeGroupParts = explode("\n", trim($tag->getContent())); |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | private function getQueryParametersFromDocBlock($tags) |
56 | 56 | { |
57 | 57 | $parameters = collect($tags) |
58 | - ->filter(function ($tag) { |
|
58 | + ->filter(function($tag) { |
|
59 | 59 | return $tag instanceof Tag && $tag->getName() === 'queryParam'; |
60 | 60 | }) |
61 | - ->mapWithKeys(function (Tag $tag) { |
|
61 | + ->mapWithKeys(function(Tag $tag) { |
|
62 | 62 | // Format: |
63 | 63 | // @queryParam <name> <"required" (optional)> <description> |
64 | 64 | // Examples: |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | list($description, $value) = $this->parseParamDescription($description, 'string'); |
85 | - if (is_null($value) && ! $this->shouldExcludeExample($tag->getContent())) { |
|
85 | + if (is_null($value) && !$this->shouldExcludeExample($tag->getContent())) { |
|
86 | 86 | $value = Str::contains($description, ['number', 'count', 'page']) |
87 | 87 | ? $this->generateDummyValue('integer') |
88 | 88 | : $this->generateDummyValue('string'); |
@@ -54,10 +54,10 @@ discard block |
||
54 | 54 | private function getBodyParametersFromDocBlock($tags) |
55 | 55 | { |
56 | 56 | $parameters = collect($tags) |
57 | - ->filter(function ($tag) { |
|
57 | + ->filter(function($tag) { |
|
58 | 58 | return $tag instanceof Tag && $tag->getName() === 'bodyParam'; |
59 | 59 | }) |
60 | - ->mapWithKeys(function (Tag $tag) { |
|
60 | + ->mapWithKeys(function(Tag $tag) { |
|
61 | 61 | // Format: |
62 | 62 | // @bodyParam <name> <type> <"required" (optional)> <description> |
63 | 63 | // Examples: |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | $type = $this->normalizeParameterType($type); |
84 | 84 | list($description, $example) = $this->parseParamDescription($description, $type); |
85 | - $value = is_null($example) && ! $this->shouldExcludeExample($tag->getContent()) |
|
85 | + $value = is_null($example) && !$this->shouldExcludeExample($tag->getContent()) |
|
86 | 86 | ? $this->generateDummyValue($type) |
87 | 87 | : $example; |
88 | 88 |
@@ -10,7 +10,6 @@ |
||
10 | 10 | use Illuminate\Http\Response; |
11 | 11 | use Illuminate\Routing\Route; |
12 | 12 | use Illuminate\Support\Arr; |
13 | -use League\Fractal\Resource\Collection; |
|
14 | 13 | use Mpociot\ApiDoc\Extracting\RouteDocBlocker; |
15 | 14 | use Mpociot\ApiDoc\Extracting\Strategies\Strategy; |
16 | 15 | use Mpociot\ApiDoc\Tools\Flags; |
@@ -141,7 +141,7 @@ |
||
141 | 141 | /** |
142 | 142 | * @param string $type |
143 | 143 | * |
144 | - * @return Model|object |
|
144 | + * @return string |
|
145 | 145 | */ |
146 | 146 | protected function instantiateApiResourceModel(string $type) |
147 | 147 | { |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | */ |
124 | 124 | private function getClassToBeTransformed(array $tags): string |
125 | 125 | { |
126 | - $modelTag = Arr::first(array_filter($tags, function ($tag) { |
|
126 | + $modelTag = Arr::first(array_filter($tags, function($tag) { |
|
127 | 127 | return ($tag instanceof Tag) && strtolower($tag->getName()) == 'apiresourcemodel'; |
128 | 128 | })); |
129 | 129 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | private function getApiResourceTag(array $tags) |
185 | 185 | { |
186 | 186 | $apiResourceTags = array_values( |
187 | - array_filter($tags, function ($tag) { |
|
187 | + array_filter($tags, function($tag) { |
|
188 | 188 | return ($tag instanceof Tag) && in_array(strtolower($tag->getName()), ['apiresource', 'apiresourcecollection']); |
189 | 189 | }) |
190 | 190 | ); |