Completed
Pull Request — master (#570)
by
unknown
01:17
created
src/ApiDocGeneratorServiceProvider.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,17 +15,17 @@
 block discarded – undo
15 15
      */
16 16
     public function boot()
17 17
     {
18
-        $this->loadViewsFrom(__DIR__.'/../resources/views/', 'apidoc');
18
+        $this->loadViewsFrom(__DIR__ . '/../resources/views/', 'apidoc');
19 19
 
20 20
         $this->publishes([
21
-            __DIR__.'/../resources/views' => app()->basePath().'/resources/views/vendor/apidoc',
21
+            __DIR__ . '/../resources/views' => app()->basePath() . '/resources/views/vendor/apidoc',
22 22
         ], 'apidoc-views');
23 23
 
24 24
         $this->publishes([
25
-            __DIR__.'/../config/apidoc.php' => app()->basePath().'/config/apidoc.php',
25
+            __DIR__ . '/../config/apidoc.php' => app()->basePath() . '/config/apidoc.php',
26 26
         ], 'apidoc-config');
27 27
 
28
-        $this->mergeConfigFrom(__DIR__.'/../config/apidoc.php', 'apidoc');
28
+        $this->mergeConfigFrom(__DIR__ . '/../config/apidoc.php', 'apidoc');
29 29
 
30 30
         if ($this->app->runningInConsole()) {
31 31
             $this->commands([
Please login to merge, or discard this patch.
src/Commands/RebuildDocumentation.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,15 +42,15 @@
 block discarded – undo
42 42
 
43 43
         $documentarian = new Documentarian();
44 44
 
45
-        if (! is_dir($outputPath)) {
46
-            $this->error('There is no existing documentation available at '.$outputPath.'.');
45
+        if (!is_dir($outputPath)) {
46
+            $this->error('There is no existing documentation available at ' . $outputPath . '.');
47 47
 
48 48
             return false;
49 49
         }
50
-        $this->info('Rebuilding API HTML code from '.$outputPath.'/source/index.md');
50
+        $this->info('Rebuilding API HTML code from ' . $outputPath . '/source/index.md');
51 51
 
52 52
         $documentarian->generate($outputPath);
53 53
 
54
-        $this->info('Wrote HTML documentation to: '.$outputPath.'/index.html');
54
+        $this->info('Wrote HTML documentation to: ' . $outputPath . '/index.html');
55 55
     }
56 56
 }
Please login to merge, or discard this patch.
src/Tools/Utils.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
 
69 69
     public static function deleteDirectoryAndContents($dir)
70 70
     {
71
-        $adapter = new Local(realpath(__DIR__.'/../../'));
71
+        $adapter = new Local(realpath(__DIR__ . '/../../'));
72 72
         $fs = new Filesystem($adapter);
73 73
         $fs->deleteDir($dir);
74 74
     }
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
      * @param string $uri
50 50
      * @param array $bindings
51 51
      *
52
-     * @return mixed
52
+     * @return string
53 53
      */
54 54
     public static function replaceUrlParameterBindings(string $uri, array $bindings)
55 55
     {
Please login to merge, or discard this patch.
src/Postman/CollectionWriter.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -41,32 +41,32 @@  discard block
 block discarded – undo
41 41
         $collection = [
42 42
             'variables' => [],
43 43
             'info' => [
44
-                'name' => config('apidoc.postman.name') ?: config('app.name').' API',
44
+                'name' => config('apidoc.postman.name') ?: config('app.name') . ' API',
45 45
                 '_postman_id' => Uuid::uuid4()->toString(),
46 46
                 'description' => config('apidoc.postman.description') ?: '',
47 47
                 'schema' => 'https://schema.getpostman.com/json/collection/v2.0.0/collection.json',
48 48
             ],
49
-            'item' => $this->routeGroups->map(function ($routes, $groupName) {
49
+            'item' => $this->routeGroups->map(function($routes, $groupName) {
50 50
                 return [
51 51
                     'name' => $groupName,
52 52
                     'description' => '',
53
-                    'item' => $routes->map(function ($route) {
53
+                    'item' => $routes->map(function($route) {
54 54
                         $mode = $route['methods'][0] === 'PUT' ? 'urlencoded' : 'formdata';
55 55
 
56 56
                         return [
57 57
                             'name' => $route['title'] != '' ? $route['title'] : url($route['uri']),
58 58
                             'request' => [
59
-                                'url' => url($route['uri']).(collect($route['queryParameters'])->isEmpty()
59
+                                'url' => url($route['uri']) . (collect($route['queryParameters'])->isEmpty()
60 60
                                     ? ''
61
-                                    : ('?'.implode('&', collect($route['queryParameters'])->map(function ($parameter, $key) {
62
-                                        return urlencode($key).'='.urlencode($parameter['value'] ?? '');
61
+                                    : ('?' . implode('&', collect($route['queryParameters'])->map(function($parameter, $key) {
62
+                                        return urlencode($key) . '=' . urlencode($parameter['value'] ?? '');
63 63
                                     })->all()))),
64 64
                                 'method' => $route['methods'][0],
65 65
                                 'header' => collect($route['headers'])
66 66
                                     ->union([
67 67
                                         'Accept' => 'application/json',
68 68
                                     ])
69
-                                    ->map(function ($value, $header) {
69
+                                    ->map(function($value, $header) {
70 70
                                         return [
71 71
                                             'key' => $header,
72 72
                                             'value' => $value,
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
                                     ->values()->all(),
76 76
                                 'body' => [
77 77
                                     'mode' => $mode,
78
-                                    $mode => collect($route['bodyParameters'])->map(function ($parameter, $key) {
78
+                                    $mode => collect($route['bodyParameters'])->map(function($parameter, $key) {
79 79
                                         return [
80 80
                                             'key' => $key,
81 81
                                             'value' => $parameter['value'] ?? '',
Please login to merge, or discard this patch.
src/Tools/RouteMatcher.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,14 +53,14 @@  discard block
 block discarded – undo
53 53
     // for each ruleset in the config file. Not a high priority, though.
54 54
     private function getAllRoutes(bool $usingDingoRouter, array $versions = [])
55 55
     {
56
-        if (! $usingDingoRouter) {
56
+        if (!$usingDingoRouter) {
57 57
             return RouteFacade::getRoutes();
58 58
         }
59 59
 
60 60
         $allRouteCollections = app(\Dingo\Api\Routing\Router::class)->getRoutes();
61 61
 
62 62
         return collect($allRouteCollections)
63
-            ->flatMap(function (RouteCollection $collection) {
63
+            ->flatMap(function(RouteCollection $collection) {
64 64
                 return $collection->getRoutes();
65 65
             })->toArray();
66 66
     }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     private function shouldIncludeRoute(Route $route, array $routeRule, array $mustIncludes, bool $usingDingoRouter)
69 69
     {
70 70
         $matchesVersion = $usingDingoRouter
71
-            ? ! empty(array_intersect($route->versions(), $routeRule['match']['versions'] ?? []))
71
+            ? !empty(array_intersect($route->versions(), $routeRule['match']['versions'] ?? []))
72 72
             : true;
73 73
 
74 74
         return str_is($mustIncludes, $route->getName())
Please login to merge, or discard this patch.
src/Strategies/Metadata/GetFromDocBlocks.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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()));
Please login to merge, or discard this patch.
src/Strategies/QueryParameters/GetFromDocBlocks.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
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) {
61
+            ->mapWithKeys(function($tag) {
62 62
                 preg_match('/(.+?)\s+(required\s+)?(.*)/', $tag->getContent(), $content);
63 63
                 $content = preg_replace('/\s?No-example.?/', '', $content);
64 64
                 if (empty($content)) {
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
                 }
78 78
 
79 79
                 list($description, $value) = $this->parseParamDescription($description, 'string');
80
-                if (is_null($value) && ! $this->shouldExcludeExample($tag)) {
80
+                if (is_null($value) && !$this->shouldExcludeExample($tag)) {
81 81
                     $value = str_contains($description, ['number', 'count', 'page'])
82 82
                         ? $this->generateDummyValue('integer')
83 83
                         : $this->generateDummyValue('string');
Please login to merge, or discard this patch.
src/Strategies/Responses/UseTransformerTags.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
             $fractal = new Manager();
49 49
  
50
-            if (! is_null(config('apidoc.fractal.serializer'))) {
50
+            if (!is_null(config('apidoc.fractal.serializer'))) {
51 51
                 $fractal->setSerializer(app(config('apidoc.fractal.serializer')));
52 52
             }
53 53
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      */
80 80
     private function getClassToBeTransformed(array $tags, ReflectionMethod $transformerMethod)
81 81
     {
82
-        $modelTag = array_first(array_filter($tags, function ($tag) {
82
+        $modelTag = array_first(array_filter($tags, function($tag) {
83 83
             return ($tag instanceof Tag) && strtolower($tag->getName()) == 'transformermodel';
84 84
         }));
85 85
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
             $type = $modelTag->getContent();
89 89
         } else {
90 90
             $parameter = array_first($transformerMethod->getParameters());
91
-            if ($parameter->hasType() && ! $parameter->getType()->isBuiltin() && class_exists((string) $parameter->getType())) {
91
+            if ($parameter->hasType() && !$parameter->getType()->isBuiltin() && class_exists((string) $parameter->getType())) {
92 92
                 // ladies and gentlemen, we have a type!
93 93
                 $type = (string) $parameter->getType();
94 94
             }
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
     private function getTransformerTag(array $tags)
134 134
     {
135 135
         $transFormerTags = array_values(
136
-            array_filter($tags, function ($tag) {
136
+            array_filter($tags, function($tag) {
137 137
                 return ($tag instanceof Tag) && in_array(strtolower($tag->getName()), ['transformer', 'transformercollection']);
138 138
             })
139 139
         );
Please login to merge, or discard this patch.
src/Strategies/Responses/UseResponseTag.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.