@@ -16,17 +16,17 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | public function boot() |
| 18 | 18 | { |
| 19 | - $this->loadViewsFrom(__DIR__.'/../resources/views/', 'apidoc'); |
|
| 19 | + $this->loadViewsFrom(__DIR__ . '/../resources/views/', 'apidoc'); |
|
| 20 | 20 | |
| 21 | 21 | $this->publishes([ |
| 22 | - __DIR__.'/../resources/views' => $this->app->basePath('resources/views/vendor/apidoc'), |
|
| 22 | + __DIR__ . '/../resources/views' => $this->app->basePath('resources/views/vendor/apidoc'), |
|
| 23 | 23 | ], 'apidoc-views'); |
| 24 | 24 | |
| 25 | 25 | $this->publishes([ |
| 26 | - __DIR__.'/../config/apidoc.php' => $this->app->configPath('apidoc.php'), |
|
| 26 | + __DIR__ . '/../config/apidoc.php' => $this->app->configPath('apidoc.php'), |
|
| 27 | 27 | ], 'apidoc-config'); |
| 28 | 28 | |
| 29 | - $this->mergeConfigFrom(__DIR__.'/../config/apidoc.php', 'apidoc'); |
|
| 29 | + $this->mergeConfigFrom(__DIR__ . '/../config/apidoc.php', 'apidoc'); |
|
| 30 | 30 | |
| 31 | 31 | $this->bootRoutes(); |
| 32 | 32 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | config('apidoc.laravel.autoload', false) |
| 61 | 61 | ) { |
| 62 | 62 | $this->loadRoutesFrom( |
| 63 | - __DIR__.'/../routes/laravel.php' |
|
| 63 | + __DIR__ . '/../routes/laravel.php' |
|
| 64 | 64 | ); |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | ]; |
| 96 | 96 | } catch (\Exception $e) { |
| 97 | 97 | echo 'Exception thrown when fetching Eloquent API resource response for ['.implode(',', |
| 98 | - $route->methods)."] {$route->uri}.\n"; |
|
| 98 | + $route->methods)."] {$route->uri}.\n"; |
|
| 99 | 99 | if (Flags::$shouldBeVerbose) { |
| 100 | 100 | Utils::dumpException($e); |
| 101 | 101 | } else { |
@@ -116,10 +116,10 @@ discard block |
||
| 116 | 116 | array_filter($tags, |
| 117 | 117 | function ($tag) { |
| 118 | 118 | return ($tag instanceof Tag) && in_array(strtolower($tag->getName()), |
| 119 | - [ |
|
| 120 | - 'apiresource', |
|
| 121 | - 'apiresourcecollection' |
|
| 122 | - ]); |
|
| 119 | + [ |
|
| 120 | + 'apiresource', |
|
| 121 | + 'apiresourcecollection' |
|
| 122 | + ]); |
|
| 123 | 123 | }) |
| 124 | 124 | ); |
| 125 | 125 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | // Collections can either use the regular JsonResource class (via `::collection()`, |
| 77 | 77 | // or a ResourceCollection (via `new`) |
| 78 | 78 | // See https://laravel.com/docs/5.8/eloquent-resources |
| 79 | - $models = [ |
|
| 79 | + $models = [ |
|
| 80 | 80 | $modelInstance, |
| 81 | 81 | $this->instantiateApiResourceModel($model, $factoryStates) |
| 82 | 82 | ]; |
@@ -95,8 +95,8 @@ discard block |
||
| 95 | 95 | ], |
| 96 | 96 | ]; |
| 97 | 97 | } catch (\Exception $e) { |
| 98 | - echo 'Exception thrown when fetching Eloquent API resource response for ['.implode(',', |
|
| 99 | - $route->methods)."] {$route->uri}.\n"; |
|
| 98 | + echo 'Exception thrown when fetching Eloquent API resource response for [' . implode(',', |
|
| 99 | + $route->methods) . "] {$route->uri}.\n"; |
|
| 100 | 100 | if (Flags::$shouldBeVerbose) { |
| 101 | 101 | Utils::dumpException($e); |
| 102 | 102 | } else { |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | private function getApiResourceTag(array $tags) { |
| 116 | 116 | $apiResourceTags = array_values( |
| 117 | 117 | array_filter($tags, |
| 118 | - function ($tag) { |
|
| 118 | + function($tag) { |
|
| 119 | 119 | return ($tag instanceof Tag) && in_array(strtolower($tag->getName()), |
| 120 | 120 | [ |
| 121 | 121 | 'apiresource', |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | */ |
| 149 | 149 | private function getClassToBeTransformed(array $tags): string { |
| 150 | 150 | $modelTag = Arr::first(array_filter($tags, |
| 151 | - function ($tag) { |
|
| 151 | + function($tag) { |
|
| 152 | 152 | return ($tag instanceof Tag) && strtolower($tag->getName()) == 'apiresourcemodel'; |
| 153 | 153 | })); |
| 154 | 154 | |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | private function getApiResourceStates(array $tags) { |
| 221 | - $tag = collect($tags)->filter(function (Tag $tag) { |
|
| 221 | + $tag = collect($tags)->filter(function(Tag $tag) { |
|
| 222 | 222 | return strtolower($tag->getName()) === 'apiresourcestate'; |
| 223 | 223 | })->first(); |
| 224 | 224 | |
@@ -226,9 +226,9 @@ discard block |
||
| 226 | 226 | return []; |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | - return collect(explode(',', $tag->getContent()))->transform(function ($item) { |
|
| 229 | + return collect(explode(',', $tag->getContent()))->transform(function($item) { |
|
| 230 | 230 | return trim($item); |
| 231 | - })->filter(function ($item) { |
|
| 231 | + })->filter(function($item) { |
|
| 232 | 232 | return strlen($item) > 0; |
| 233 | 233 | })->toArray(); |
| 234 | 234 | } |