Completed
Pull Request — master (#690)
by
unknown
01:33
created
src/Matching/RouteMatcher.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -64,14 +64,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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())
Please login to merge, or discard this patch.
src/Extracting/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.
src/Extracting/Strategies/Responses/UseApiResourceTags.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
                 ],
93 93
             ];
94 94
         } catch (\Exception $e) {
95
-            echo 'Exception thrown when fetching Eloquent API resource response for ['.implode(',', $route->methods)."] {$route->uri}.\n";
95
+            echo 'Exception thrown when fetching Eloquent API resource response for [' . implode(',', $route->methods) . "] {$route->uri}.\n";
96 96
             if (Flags::$shouldBeVerbose) {
97 97
                 Utils::dumpException($e);
98 98
             } else {
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
      */
126 126
     private function getClassToBeTransformed(array $tags): string
127 127
     {
128
-        $modelTag = Arr::first(array_filter($tags, function ($tag) {
128
+        $modelTag = Arr::first(array_filter($tags, function($tag) {
129 129
             return ($tag instanceof Tag) && strtolower($tag->getName()) == 'apiresourcemodel';
130 130
         }));
131 131
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
     private function getApiResourceTag(array $tags)
187 187
     {
188 188
         $apiResourceTags = array_values(
189
-            array_filter($tags, function ($tag) {
189
+            array_filter($tags, function($tag) {
190 190
                 return ($tag instanceof Tag) && in_array(strtolower($tag->getName()), ['apiresource', 'apiresourcecollection']);
191 191
             })
192 192
         );
Please login to merge, or discard this patch.
src/Extracting/Strategies/UrlParameters/GetFromUrlParamTag.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 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
 block discarded – undo
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');
Please login to merge, or discard this patch.
src/Extracting/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/Extracting/Strategies/QueryParameters/GetFromQueryParamTag.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 $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
 block discarded – undo
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');
Please login to merge, or discard this patch.
src/Extracting/Strategies/BodyParameters/GetFromBodyParamTag.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -54,10 +54,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Tools/Utils.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     public static function replaceUrlParameterPlaceholdersWithValues(string $uri, array $urlParameters)
54 54
     {
55 55
         $matches = preg_match_all('/{.+?}/i', $uri, $parameterPaths);
56
-        if (! $matches) {
56
+        if (!$matches) {
57 57
             return $uri;
58 58
         }
59 59
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 
89 89
     public static function deleteDirectoryAndContents($dir)
90 90
     {
91
-        $adapter = new Local(realpath(__DIR__.'/../../'));
91
+        $adapter = new Local(realpath(__DIR__ . '/../../'));
92 92
         $fs = new Filesystem($adapter);
93 93
         $fs->deleteDir($dir);
94 94
     }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         $result = '';
102 102
         $padWith = str_repeat(' ', $indentationLevel);
103 103
         foreach ($split as $index => $line) {
104
-            $result .= ($index == 0 ? '' : "\n$padWith").$line;
104
+            $result .= ($index == 0 ? '' : "\n$padWith") . $line;
105 105
         }
106 106
 
107 107
         return $result;
Please login to merge, or discard this patch.
src/Extracting/Strategies/Responses/UseResponseFileTag.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     {
45 45
         // Avoid "holes" in the keys of the filtered array, by using array_values on the filtered array
46 46
         $responseFileTags = array_values(
47
-            array_filter($tags, function ($tag) {
47
+            array_filter($tags, function($tag) {
48 48
                 return $tag instanceof Tag && strtolower($tag->getName()) === 'responsefile';
49 49
             })
50 50
         );
@@ -53,16 +53,16 @@  discard block
 block discarded – undo
53 53
             return null;
54 54
         }
55 55
 
56
-        $responses = array_map(function (Tag $responseFileTag) {
56
+        $responses = array_map(function(Tag $responseFileTag) {
57 57
             preg_match('/^(\d{3})?\s?([\S]*[\s]*?)(\{.*\})?$/', $responseFileTag->getContent(), $result);
58 58
             $relativeFilePath = trim($result[2]);
59 59
             $filePath = storage_path($relativeFilePath);
60
-            if (! file_exists($filePath)) {
61
-                throw new \Exception('@responseFile '.$relativeFilePath.' does not exist');
60
+            if (!file_exists($filePath)) {
61
+                throw new \Exception('@responseFile ' . $relativeFilePath . ' does not exist');
62 62
             }
63 63
             $status = $result[1] ?: 200;
64 64
             $content = $result[2] ? file_get_contents($filePath, true) : '{}';
65
-            $json = ! empty($result[3]) ? str_replace("'", '"', $result[3]) : '{}';
65
+            $json = !empty($result[3]) ? str_replace("'", '"', $result[3]) : '{}';
66 66
             $merged = array_merge(json_decode($content, true), json_decode($json, true));
67 67
 
68 68
             return ['content' => json_encode($merged), 'status' => (int) $status];
Please login to merge, or discard this patch.