@@ -77,7 +77,7 @@ |
||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | - * @param null $rule |
|
| 80 | + * @param string $rule |
|
| 81 | 81 | * |
| 82 | 82 | * @return static |
| 83 | 83 | */ |
@@ -34,8 +34,7 @@ discard block |
||
| 34 | 34 | public function with($parameters) |
| 35 | 35 | { |
| 36 | 36 | is_array($parameters) ? |
| 37 | - $this->parameters += $parameters : |
|
| 38 | - $this->parameters[] = $parameters; |
|
| 37 | + $this->parameters += $parameters : $this->parameters[] = $parameters; |
|
| 39 | 38 | |
| 40 | 39 | return $this; |
| 41 | 40 | } |
@@ -54,8 +53,7 @@ discard block |
||
| 54 | 53 | protected function makeDescription() |
| 55 | 54 | { |
| 56 | 55 | $description = trans()->hasForLocale($this->rule) ? |
| 57 | - trans()->get($this->rule) : |
|
| 58 | - trans()->get($this->rule, [], self::DEFAULT_LOCALE); |
|
| 56 | + trans()->get($this->rule) : trans()->get($this->rule, [], self::DEFAULT_LOCALE); |
|
| 59 | 57 | |
| 60 | 58 | return $this->replaceAttributes($description); |
| 61 | 59 | } |
@@ -15,12 +15,12 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | public function boot() |
| 17 | 17 | { |
| 18 | - $this->loadViewsFrom(__DIR__.'/../../resources/views/', 'apidoc'); |
|
| 19 | - $this->loadTranslationsFrom(__DIR__.'/../../resources/lang', 'apidoc'); |
|
| 18 | + $this->loadViewsFrom(__DIR__ . '/../../resources/views/', 'apidoc'); |
|
| 19 | + $this->loadTranslationsFrom(__DIR__ . '/../../resources/lang', 'apidoc'); |
|
| 20 | 20 | |
| 21 | 21 | $this->publishes([ |
| 22 | - __DIR__.'/../../resources/lang' => $this->resource_path('lang/vendor/apidoc'), |
|
| 23 | - __DIR__.'/../../resources/views' => $this->resource_path('views/vendor/apidoc'), |
|
| 22 | + __DIR__ . '/../../resources/lang' => $this->resource_path('lang/vendor/apidoc'), |
|
| 23 | + __DIR__ . '/../../resources/views' => $this->resource_path('views/vendor/apidoc'), |
|
| 24 | 24 | ]); |
| 25 | 25 | } |
| 26 | 26 | |
@@ -31,10 +31,10 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | public function register() |
| 33 | 33 | { |
| 34 | - $this->app->singleton('apidoc.generate', function () { |
|
| 34 | + $this->app->singleton('apidoc.generate', function() { |
|
| 35 | 35 | return new GenerateDocumentation(); |
| 36 | 36 | }); |
| 37 | - $this->app->singleton('apidoc.update', function () { |
|
| 37 | + $this->app->singleton('apidoc.update', function() { |
|
| 38 | 38 | return new UpdateDocumentation(); |
| 39 | 39 | }); |
| 40 | 40 | |
@@ -53,6 +53,6 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | public function resource_path($path = '') |
| 55 | 55 | { |
| 56 | - return app()->basePath().'/resources'.($path ? '/'.$path : $path); |
|
| 56 | + return app()->basePath() . '/resources' . ($path ? '/' . $path : $path); |
|
| 57 | 57 | } |
| 58 | 58 | } |
@@ -32,11 +32,11 @@ discard block |
||
| 32 | 32 | 'description' => '', |
| 33 | 33 | 'schema' => 'https://schema.getpostman.com/json/collection/v2.0.0/collection.json', |
| 34 | 34 | ], |
| 35 | - 'item' => $this->routeGroups->map(function ($routes, $groupName) { |
|
| 35 | + 'item' => $this->routeGroups->map(function($routes, $groupName) { |
|
| 36 | 36 | return [ |
| 37 | 37 | 'name' => $groupName, |
| 38 | 38 | 'description' => '', |
| 39 | - 'item' => $routes->map(function ($route) { |
|
| 39 | + 'item' => $routes->map(function($route) { |
|
| 40 | 40 | return [ |
| 41 | 41 | 'name' => $route['title'] != '' ? $route['title'] : url($route['uri']), |
| 42 | 42 | 'request' => [ |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | 'method' => $route['methods'][0], |
| 45 | 45 | 'body' => [ |
| 46 | 46 | 'mode' => 'formdata', |
| 47 | - 'formdata' => collect($route['parameters'])->map(function ($parameter, $key) { |
|
| 47 | + 'formdata' => collect($route['parameters'])->map(function($parameter, $key) { |
|
| 48 | 48 | return [ |
| 49 | 49 | 'key' => $key, |
| 50 | 50 | 'value' => isset($parameter['value']) ? $parameter['value'] : '', |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | || (str_is($routeDomain, $generator->getDomain($route)) |
| 276 | 276 | && str_is($routePrefix, $generator->getUri($route))) |
| 277 | 277 | || in_array($middleware, $route->middleware()) |
| 278 | - ) { |
|
| 278 | + ) { |
|
| 279 | 279 | if ($this->isValidRoute($route) && $this->isRouteVisibleForDocumentation($route->getAction()['uses'])) { |
| 280 | 280 | $parsedRoutes[] = $generator->processRoute($route, $bindings, $this->option('header'), $withResponse && in_array('GET', $generator->getMethods($route))); |
| 281 | 281 | $this->info('Processed route: ['.implode(',', $generator->getMethods($route)).'] '.$generator->getUri($route)); |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | || (str_is($routeDomain, $generator->getDomain($route)) |
| 310 | 310 | && str_is($routePrefix, $generator->getUri($route))) |
| 311 | 311 | || in_array($middleware, $route->middleware()) |
| 312 | - ) { |
|
| 312 | + ) { |
|
| 313 | 313 | if ($this->isValidRoute($route) && $this->isRouteVisibleForDocumentation($route->getAction()['uses'])) { |
| 314 | 314 | $parsedRoutes[] = $generator->processRoute($route, $bindings, $this->option('header'), $withResponse && in_array('GET', $generator->getMethods($route))); |
| 315 | 315 | $this->info('Processed route: ['.implode(',', $generator->getMethods($route)).'] '.$route->uri()); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | $this->setUserToBeImpersonated($this->option('actAsUserId')); |
| 77 | 77 | |
| 78 | - if ($routePrefix === null && $routeDomain === null && ! count($allowedRoutes) && $middleware === null) { |
|
| 78 | + if ($routePrefix === null && $routeDomain === null && !count($allowedRoutes) && $middleware === null) { |
|
| 79 | 79 | $this->error('You must provide either a route prefix, a route domain, a route or a middleware to generate the documentation.'); |
| 80 | 80 | |
| 81 | 81 | return false; |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | - $parsedRoutes = collect($parsedRoutes)->groupBy('resource')->sort(function ($a, $b) { |
|
| 104 | + $parsedRoutes = collect($parsedRoutes)->groupBy('resource')->sort(function($a, $b) { |
|
| 105 | 105 | return strcmp($a->first()['resource'], $b->first()['resource']); |
| 106 | 106 | }); |
| 107 | 107 | |
@@ -116,15 +116,15 @@ discard block |
||
| 116 | 116 | private function writeMarkdown($parsedRoutes) |
| 117 | 117 | { |
| 118 | 118 | $outputPath = $this->option('output'); |
| 119 | - $targetFile = $outputPath.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR.'index.md'; |
|
| 120 | - $compareFile = $outputPath.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR.'.compare.md'; |
|
| 119 | + $targetFile = $outputPath . DIRECTORY_SEPARATOR . 'source' . DIRECTORY_SEPARATOR . 'index.md'; |
|
| 120 | + $compareFile = $outputPath . DIRECTORY_SEPARATOR . 'source' . DIRECTORY_SEPARATOR . '.compare.md'; |
|
| 121 | 121 | |
| 122 | 122 | $infoText = view('apidoc::partials.info') |
| 123 | 123 | ->with('outputPath', ltrim($outputPath, 'public/')) |
| 124 | - ->with('showPostmanCollectionButton', ! $this->option('noPostmanCollection')); |
|
| 124 | + ->with('showPostmanCollectionButton', !$this->option('noPostmanCollection')); |
|
| 125 | 125 | |
| 126 | - $parsedRouteOutput = $parsedRoutes->map(function ($routeGroup) { |
|
| 127 | - return $routeGroup->map(function ($route) { |
|
| 126 | + $parsedRouteOutput = $parsedRoutes->map(function($routeGroup) { |
|
| 127 | + return $routeGroup->map(function($route) { |
|
| 128 | 128 | $route['output'] = (string) view('apidoc::partials.route')->with('parsedRoute', $route)->render(); |
| 129 | 129 | |
| 130 | 130 | return $route; |
@@ -144,16 +144,16 @@ discard block |
||
| 144 | 144 | $frontmatter = trim($generatedFrontmatter[1], "\n"); |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - $parsedRouteOutput->transform(function ($routeGroup) use ($generatedDocumentation, $compareDocumentation) { |
|
| 148 | - return $routeGroup->transform(function ($route) use ($generatedDocumentation, $compareDocumentation) { |
|
| 149 | - if (preg_match('/<!-- START_'.$route['id'].' -->(.*)<!-- END_'.$route['id'].' -->/is', $generatedDocumentation, $routeMatch)) { |
|
| 150 | - $routeDocumentationChanged = (preg_match('/<!-- START_'.$route['id'].' -->(.*)<!-- END_'.$route['id'].' -->/is', $compareDocumentation, $compareMatch) && $compareMatch[1] !== $routeMatch[1]); |
|
| 147 | + $parsedRouteOutput->transform(function($routeGroup) use ($generatedDocumentation, $compareDocumentation) { |
|
| 148 | + return $routeGroup->transform(function($route) use ($generatedDocumentation, $compareDocumentation) { |
|
| 149 | + if (preg_match('/<!-- START_' . $route['id'] . ' -->(.*)<!-- END_' . $route['id'] . ' -->/is', $generatedDocumentation, $routeMatch)) { |
|
| 150 | + $routeDocumentationChanged = (preg_match('/<!-- START_' . $route['id'] . ' -->(.*)<!-- END_' . $route['id'] . ' -->/is', $compareDocumentation, $compareMatch) && $compareMatch[1] !== $routeMatch[1]); |
|
| 151 | 151 | if ($routeDocumentationChanged === false || $this->option('force')) { |
| 152 | 152 | if ($routeDocumentationChanged) { |
| 153 | - $this->warn('Discarded manual changes for route ['.implode(',', $route['methods']).'] '.$route['uri']); |
|
| 153 | + $this->warn('Discarded manual changes for route [' . implode(',', $route['methods']) . '] ' . $route['uri']); |
|
| 154 | 154 | } |
| 155 | 155 | } else { |
| 156 | - $this->warn('Skipping modified route ['.implode(',', $route['methods']).'] '.$route['uri']); |
|
| 156 | + $this->warn('Skipping modified route [' . implode(',', $route['methods']) . '] ' . $route['uri']); |
|
| 157 | 157 | $route['modified_output'] = $routeMatch[0]; |
| 158 | 158 | } |
| 159 | 159 | } |
@@ -170,10 +170,10 @@ discard block |
||
| 170 | 170 | ->with('frontmatter', $frontmatter) |
| 171 | 171 | ->with('infoText', $infoText) |
| 172 | 172 | ->with('outputPath', $this->option('output')) |
| 173 | - ->with('showPostmanCollectionButton', ! $this->option('noPostmanCollection')) |
|
| 173 | + ->with('showPostmanCollectionButton', !$this->option('noPostmanCollection')) |
|
| 174 | 174 | ->with('parsedRoutes', $parsedRouteOutput); |
| 175 | 175 | |
| 176 | - if (! is_dir($outputPath)) { |
|
| 176 | + if (!is_dir($outputPath)) { |
|
| 177 | 177 | $documentarian->create($outputPath); |
| 178 | 178 | } |
| 179 | 179 | |
@@ -186,23 +186,23 @@ discard block |
||
| 186 | 186 | ->with('frontmatter', $frontmatter) |
| 187 | 187 | ->with('infoText', $infoText) |
| 188 | 188 | ->with('outputPath', $this->option('output')) |
| 189 | - ->with('showPostmanCollectionButton', ! $this->option('noPostmanCollection')) |
|
| 189 | + ->with('showPostmanCollectionButton', !$this->option('noPostmanCollection')) |
|
| 190 | 190 | ->with('parsedRoutes', $parsedRouteOutput); |
| 191 | 191 | |
| 192 | 192 | file_put_contents($compareFile, $compareMarkdown); |
| 193 | 193 | |
| 194 | - $this->info('Wrote index.md to: '.$outputPath); |
|
| 194 | + $this->info('Wrote index.md to: ' . $outputPath); |
|
| 195 | 195 | |
| 196 | 196 | $this->info('Generating API HTML code'); |
| 197 | 197 | |
| 198 | 198 | $documentarian->generate($outputPath); |
| 199 | 199 | |
| 200 | - $this->info('Wrote HTML documentation to: '.$outputPath.'/index.html'); |
|
| 200 | + $this->info('Wrote HTML documentation to: ' . $outputPath . '/index.html'); |
|
| 201 | 201 | |
| 202 | 202 | if ($this->option('noPostmanCollection') !== true) { |
| 203 | 203 | $this->info('Generating Postman collection'); |
| 204 | 204 | |
| 205 | - file_put_contents($outputPath.DIRECTORY_SEPARATOR.'collection.json', $this->generatePostmanCollection($parsedRoutes)); |
|
| 205 | + file_put_contents($outputPath . DIRECTORY_SEPARATOR . 'collection.json', $this->generatePostmanCollection($parsedRoutes)); |
|
| 206 | 206 | } |
| 207 | 207 | } |
| 208 | 208 | |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | */ |
| 231 | 231 | private function setUserToBeImpersonated($actAs) |
| 232 | 232 | { |
| 233 | - if (! empty($actAs)) { |
|
| 233 | + if (!empty($actAs)) { |
|
| 234 | 234 | if (version_compare($this->laravel->version(), '5.2.0', '<')) { |
| 235 | 235 | $userModel = config('auth.model'); |
| 236 | 236 | $user = $userModel::find($actAs); |
@@ -278,9 +278,9 @@ discard block |
||
| 278 | 278 | ) { |
| 279 | 279 | if ($this->isValidRoute($route) && $this->isRouteVisibleForDocumentation($route->getAction()['uses'])) { |
| 280 | 280 | $parsedRoutes[] = $generator->processRoute($route, $bindings, $this->option('header'), $withResponse && in_array('GET', $generator->getMethods($route))); |
| 281 | - $this->info('Processed route: ['.implode(',', $generator->getMethods($route)).'] '.$generator->getUri($route)); |
|
| 281 | + $this->info('Processed route: [' . implode(',', $generator->getMethods($route)) . '] ' . $generator->getUri($route)); |
|
| 282 | 282 | } else { |
| 283 | - $this->warn('Skipping route: ['.implode(',', $generator->getMethods($route)).'] '.$generator->getUri($route)); |
|
| 283 | + $this->warn('Skipping route: [' . implode(',', $generator->getMethods($route)) . '] ' . $generator->getUri($route)); |
|
| 284 | 284 | } |
| 285 | 285 | } |
| 286 | 286 | } |
@@ -312,9 +312,9 @@ discard block |
||
| 312 | 312 | ) { |
| 313 | 313 | if ($this->isValidRoute($route) && $this->isRouteVisibleForDocumentation($route->getAction()['uses'])) { |
| 314 | 314 | $parsedRoutes[] = $generator->processRoute($route, $bindings, $this->option('header'), $withResponse && in_array('GET', $generator->getMethods($route))); |
| 315 | - $this->info('Processed route: ['.implode(',', $generator->getMethods($route)).'] '.$route->uri()); |
|
| 315 | + $this->info('Processed route: [' . implode(',', $generator->getMethods($route)) . '] ' . $route->uri()); |
|
| 316 | 316 | } else { |
| 317 | - $this->warn('Skipping route: ['.implode(',', $generator->getMethods($route)).'] '.$route->uri()); |
|
| 317 | + $this->warn('Skipping route: [' . implode(',', $generator->getMethods($route)) . '] ' . $route->uri()); |
|
| 318 | 318 | } |
| 319 | 319 | } |
| 320 | 320 | } |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | */ |
| 330 | 330 | private function isValidRoute($route) |
| 331 | 331 | { |
| 332 | - return ! is_callable($route->getAction()['uses']) && ! is_null($route->getAction()['uses']); |
|
| 332 | + return !is_callable($route->getAction()['uses']) && !is_null($route->getAction()['uses']); |
|
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | /** |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | $phpdoc = new DocBlock($comment); |
| 347 | 347 | |
| 348 | 348 | return collect($phpdoc->getTags()) |
| 349 | - ->filter(function ($tag) use ($route) { |
|
| 349 | + ->filter(function($tag) use ($route) { |
|
| 350 | 350 | return $tag->getName() === 'hideFromAPIDocumentation'; |
| 351 | 351 | }) |
| 352 | 352 | ->isEmpty(); |
@@ -44,8 +44,8 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | $documentarian = new Documentarian(); |
| 46 | 46 | |
| 47 | - if (! is_dir($outputPath)) { |
|
| 48 | - $this->error('There is no generated documentation available at '.$outputPath.'.'); |
|
| 47 | + if (!is_dir($outputPath)) { |
|
| 48 | + $this->error('There is no generated documentation available at ' . $outputPath . '.'); |
|
| 49 | 49 | |
| 50 | 50 | return false; |
| 51 | 51 | } |
@@ -53,6 +53,6 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | $documentarian->generate($outputPath); |
| 55 | 55 | |
| 56 | - $this->info('Wrote HTML documentation to: '.$outputPath.'/index.html'); |
|
| 56 | + $this->info('Wrote HTML documentation to: ' . $outputPath . '/index.html'); |
|
| 57 | 57 | } |
| 58 | 58 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | /** |
| 18 | 18 | * @param Route $route |
| 19 | 19 | * |
| 20 | - * @return mixed |
|
| 20 | + * @return string|null |
|
| 21 | 21 | */ |
| 22 | 22 | public function getDomain($route) |
| 23 | 23 | { |
@@ -57,7 +57,6 @@ discard block |
||
| 57 | 57 | /** |
| 58 | 58 | * Prepares / Disables route middlewares. |
| 59 | 59 | * |
| 60 | - * @param bool $disable |
|
| 61 | 60 | * |
| 62 | 61 | * @return void |
| 63 | 62 | */ |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | */ |
| 58 | 58 | public function prepareMiddleware($enable = true) |
| 59 | 59 | { |
| 60 | - App::instance('middleware.disable', ! $enable); |
|
| 60 | + App::instance('middleware.disable', !$enable); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | { |
| 26 | 26 | $dispatcher = app('Dingo\Api\Dispatcher')->raw(); |
| 27 | 27 | |
| 28 | - collect($server)->map(function ($key, $value) use ($dispatcher) { |
|
| 28 | + collect($server)->map(function($key, $value) use ($dispatcher) { |
|
| 29 | 29 | $dispatcher->header($value, $key); |
| 30 | 30 | }); |
| 31 | 31 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | /** |
| 22 | 22 | * @param $route |
| 23 | 23 | * |
| 24 | - * @return mixed |
|
| 24 | + * @return string |
|
| 25 | 25 | */ |
| 26 | 26 | abstract public function getDomain($route); |
| 27 | 27 | |
@@ -99,7 +99,6 @@ discard block |
||
| 99 | 99 | /** |
| 100 | 100 | * Prepares / Disables route middlewares. |
| 101 | 101 | * |
| 102 | - * @param bool $disable |
|
| 103 | 102 | * |
| 104 | 103 | * @return void |
| 105 | 104 | */ |
@@ -110,7 +109,7 @@ discard block |
||
| 110 | 109 | * |
| 111 | 110 | * @param array $tags |
| 112 | 111 | * |
| 113 | - * @return mixed |
|
| 112 | + * @return null|\Symfony\Component\HttpFoundation\Response |
|
| 114 | 113 | */ |
| 115 | 114 | protected function getDocblockResponse($tags) |
| 116 | 115 | { |
@@ -183,7 +182,7 @@ discard block |
||
| 183 | 182 | } |
| 184 | 183 | |
| 185 | 184 | /** |
| 186 | - * @param $route |
|
| 185 | + * @param \Illuminate\Routing\Route $route |
|
| 187 | 186 | * @param $bindings |
| 188 | 187 | * @param $headers |
| 189 | 188 | * |
@@ -633,7 +632,7 @@ discard block |
||
| 633 | 632 | * @param string $rule |
| 634 | 633 | * @param string $parameter |
| 635 | 634 | * |
| 636 | - * @return array |
|
| 635 | + * @return string |
|
| 637 | 636 | */ |
| 638 | 637 | protected function parseParameters($rule, $parameter) |
| 639 | 638 | { |
@@ -664,7 +663,7 @@ discard block |
||
| 664 | 663 | } |
| 665 | 664 | |
| 666 | 665 | /** |
| 667 | - * @param $response |
|
| 666 | + * @param null|\Symfony\Component\HttpFoundation\Response $response |
|
| 668 | 667 | * |
| 669 | 668 | * @return mixed |
| 670 | 669 | */ |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | $response = $docblockResponse; |
| 66 | 66 | $showresponse = true; |
| 67 | 67 | } |
| 68 | - if (! $response) { |
|
| 68 | + if (!$response) { |
|
| 69 | 69 | $transformerResponse = $this->getTransformerResponse($routeDescription['tags']); |
| 70 | 70 | if ($transformerResponse) { |
| 71 | 71 | // we have a transformer response from the docblock ( @transformer || @transformercollection ) |
@@ -73,18 +73,18 @@ discard block |
||
| 73 | 73 | $showresponse = true; |
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | - if (! $response && $withResponse) { |
|
| 76 | + if (!$response && $withResponse) { |
|
| 77 | 77 | try { |
| 78 | 78 | $response = $this->getRouteResponse($route, $bindings, $headers); |
| 79 | 79 | } catch (\Exception $e) { |
| 80 | - dump("Couldn't get response for route: ".implode(',', $this->getMethods($route)).'] '.$route->uri().'', $e->getMessage()); |
|
| 80 | + dump("Couldn't get response for route: " . implode(',', $this->getMethods($route)) . '] ' . $route->uri() . '', $e->getMessage()); |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | $content = $this->getResponseContent($response); |
| 85 | 85 | |
| 86 | 86 | return $this->getParameters([ |
| 87 | - 'id' => md5($this->getUri($route).':'.implode($this->getMethods($route))), |
|
| 87 | + 'id' => md5($this->getUri($route) . ':' . implode($this->getMethods($route))), |
|
| 88 | 88 | 'resource' => $routeGroup, |
| 89 | 89 | 'title' => $routeDescription['short'], |
| 90 | 90 | 'description' => $routeDescription['long'], |
@@ -114,8 +114,8 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | protected function getDocblockResponse($tags) |
| 116 | 116 | { |
| 117 | - $responseTags = array_filter($tags, function ($tag) { |
|
| 118 | - if (! ($tag instanceof Tag)) { |
|
| 117 | + $responseTags = array_filter($tags, function($tag) { |
|
| 118 | + if (!($tag instanceof Tag)) { |
|
| 119 | 119 | return false; |
| 120 | 120 | } |
| 121 | 121 | |
@@ -173,9 +173,9 @@ discard block |
||
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | $values = collect($simplifiedRules) |
| 176 | - ->filter(function ($values) { |
|
| 176 | + ->filter(function($values) { |
|
| 177 | 177 | return in_array('array', $values); |
| 178 | - })->map(function ($val, $key) { |
|
| 178 | + })->map(function($val, $key) { |
|
| 179 | 179 | return ['']; |
| 180 | 180 | })->all(); |
| 181 | 181 | |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | $methods = $this->getMethods($route); |
| 197 | 197 | |
| 198 | 198 | // Split headers into key - value pairs |
| 199 | - $headers = collect($headers)->map(function ($value) { |
|
| 199 | + $headers = collect($headers)->map(function($value) { |
|
| 200 | 200 | $split = explode(':', $value); // explode to get key + values |
| 201 | 201 | $key = array_shift($split); // extract the key and keep the values in the array |
| 202 | 202 | $value = implode(':', $split); // implode values into string again |
@@ -220,8 +220,8 @@ discard block |
||
| 220 | 220 | { |
| 221 | 221 | $uri = $this->getUri($route); |
| 222 | 222 | foreach ($bindings as $model => $id) { |
| 223 | - $uri = str_replace('{'.$model.'}', $id, $uri); |
|
| 224 | - $uri = str_replace('{'.$model.'?}', $id, $uri); |
|
| 223 | + $uri = str_replace('{' . $model . '}', $id, $uri); |
|
| 224 | + $uri = str_replace('{' . $model . '?}', $id, $uri); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | return $uri; |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | |
| 286 | 286 | foreach ($reflectionMethod->getParameters() as $parameter) { |
| 287 | 287 | $parameterType = $parameter->getClass(); |
| 288 | - if (! is_null($parameterType) && class_exists($parameterType->name)) { |
|
| 288 | + if (!is_null($parameterType) && class_exists($parameterType->name)) { |
|
| 289 | 289 | $className = $parameterType->name; |
| 290 | 290 | |
| 291 | 291 | if (is_subclass_of($className, FormRequest::class)) { |
@@ -321,8 +321,8 @@ discard block |
||
| 321 | 321 | */ |
| 322 | 322 | protected function fancyImplode($arr, $first, $last) |
| 323 | 323 | { |
| 324 | - $arr = array_map(function ($value) { |
|
| 325 | - return '`'.$value.'`'; |
|
| 324 | + $arr = array_map(function($value) { |
|
| 325 | + return '`' . $value . '`'; |
|
| 326 | 326 | }, $arr); |
| 327 | 327 | array_push($arr, implode($last, array_splice($arr, -2))); |
| 328 | 328 | |
@@ -332,8 +332,8 @@ discard block |
||
| 332 | 332 | protected function splitValuePairs($parameters, $first = 'is ', $last = 'or ') |
| 333 | 333 | { |
| 334 | 334 | $attribute = ''; |
| 335 | - collect($parameters)->map(function ($item, $key) use (&$attribute, $first, $last) { |
|
| 336 | - $attribute .= '`'.$item.'` '; |
|
| 335 | + collect($parameters)->map(function($item, $key) use (&$attribute, $first, $last) { |
|
| 336 | + $attribute .= '`' . $item . '` '; |
|
| 337 | 337 | if (($key + 1) % 2 === 0) { |
| 338 | 338 | $attribute .= $last; |
| 339 | 339 | } else { |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | } |
| 417 | 417 | break; |
| 418 | 418 | case 'between': |
| 419 | - if (! isset($attributeData['type'])) { |
|
| 419 | + if (!isset($attributeData['type'])) { |
|
| 420 | 420 | $attributeData['type'] = 'numeric'; |
| 421 | 421 | } |
| 422 | 422 | $attributeData['description'][] = Description::parse($rule)->with($parameters)->getDescription(); |
@@ -594,8 +594,8 @@ discard block |
||
| 594 | 594 | foreach ($headers as $name => $value) { |
| 595 | 595 | $name = strtr(strtoupper($name), '-', '_'); |
| 596 | 596 | |
| 597 | - if (! Str::startsWith($name, $prefix) && $name !== 'CONTENT_TYPE') { |
|
| 598 | - $name = $prefix.$name; |
|
| 597 | + if (!Str::startsWith($name, $prefix) && $name !== 'CONTENT_TYPE') { |
|
| 598 | + $name = $prefix . $name; |
|
| 599 | 599 | } |
| 600 | 600 | |
| 601 | 601 | $server[$name] = $value; |
@@ -692,8 +692,8 @@ discard block |
||
| 692 | 692 | protected function getTransformerResponse($tags) |
| 693 | 693 | { |
| 694 | 694 | try { |
| 695 | - $transFormerTags = array_filter($tags, function ($tag) { |
|
| 696 | - if (! ($tag instanceof Tag)) { |
|
| 695 | + $transFormerTags = array_filter($tags, function($tag) { |
|
| 696 | + if (!($tag instanceof Tag)) { |
|
| 697 | 697 | return false; |
| 698 | 698 | } |
| 699 | 699 | |
@@ -704,8 +704,8 @@ discard block |
||
| 704 | 704 | return false; |
| 705 | 705 | } |
| 706 | 706 | |
| 707 | - $modelTag = array_first(array_filter($tags, function ($tag) { |
|
| 708 | - if (! ($tag instanceof Tag)) { |
|
| 707 | + $modelTag = array_first(array_filter($tags, function($tag) { |
|
| 708 | + if (!($tag instanceof Tag)) { |
|
| 709 | 709 | return false; |
| 710 | 710 | } |
| 711 | 711 | |
@@ -713,7 +713,7 @@ discard block |
||
| 713 | 713 | })); |
| 714 | 714 | $tag = \array_first($transFormerTags); |
| 715 | 715 | $transformer = $tag->getContent(); |
| 716 | - if (! \class_exists($transformer)) { |
|
| 716 | + if (!\class_exists($transformer)) { |
|
| 717 | 717 | // if we can't find the transformer we can't generate a response |
| 718 | 718 | return; |
| 719 | 719 | } |
@@ -729,7 +729,7 @@ discard block |
||
| 729 | 729 | if (version_compare(PHP_VERSION, '7.0.0') >= 0 && \is_null($type)) { |
| 730 | 730 | // we can only get the type with reflection for PHP 7 |
| 731 | 731 | if ($parameter->hasType() && |
| 732 | - ! $parameter->getType()->isBuiltin() && |
|
| 732 | + !$parameter->getType()->isBuiltin() && |
|
| 733 | 733 | \class_exists((string) $parameter->getType())) { |
| 734 | 734 | //we have a type |
| 735 | 735 | $type = (string) $parameter->getType(); |