Completed
Pull Request — master (#589)
by
unknown
12:05 queued 02:55
created
src/Tools/Generator.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
         $method = $controller->getMethod($methodName);
55 55
 
56 56
         $parsedRoute = [
57
-            'id' => md5($this->getUri($route).':'.implode($this->getMethods($route))),
57
+            'id' => md5($this->getUri($route) . ':' . implode($this->getMethods($route))),
58 58
             'methods' => $this->getMethods($route),
59 59
             'uri' => $this->getUri($route),
60 60
             'boundUri' => Utils::getFullUrl($route, $rulesToApply['bindings'] ?? ($rulesToApply['response_calls']['bindings'] ?? [])),
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
         $responses = $this->fetchResponses($controller, $method, $route, $rulesToApply, $parsedRoute);
73 73
         $parsedRoute['response'] = $responses;
74
-        $parsedRoute['showresponse'] = ! empty($responses);
74
+        $parsedRoute['showresponse'] = !empty($responses);
75 75
 
76 76
         $baseHeaders = $rulesToApply['headers'] ?? [];
77 77
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     {
114 114
         $responses = $this->iterateThroughStrategies('responses', $context, [$route, $controller, $method, $rulesToApply]);
115 115
         if (count($responses)) {
116
-            return collect($responses)->map(function (string $response, int $status) {
116
+            return collect($responses)->map(function(string $response, int $status) {
117 117
                 return [
118 118
                     'status' => $status ?: 200,
119 119
                     'content' => $response,
@@ -152,14 +152,14 @@  discard block
 block discarded – undo
152 152
             $strategy = new $strategyClass($stage, $this->config);
153 153
             $arguments[] = $context;
154 154
             $results = $strategy(...$arguments);
155
-            if (! is_null($results)) {
155
+            if (!is_null($results)) {
156 156
                 foreach ($results as $index => $item) {
157 157
                     // Using a for loop rather than array_merge or +=
158 158
                     // so it does not renumber numeric keys
159 159
                     // and also allows values to be overwritten
160 160
 
161 161
                     // Don't allow overwriting if an empty value is trying to replace a set one
162
-                    if (! in_array($context[$stage], [null, ''], true) && in_array($item, [null, ''], true)) {
162
+                    if (!in_array($context[$stage], [null, ''], true) && in_array($item, [null, ''], true)) {
163 163
                         continue;
164 164
                     } else {
165 165
                         $context[$stage][$index] = $item;
@@ -184,8 +184,8 @@  discard block
 block discarded – undo
184 184
         $values = [];
185 185
 
186 186
         // Remove params which have no examples.
187
-        $params = array_filter($params, function ($details) {
188
-            return ! is_null($details['value']);
187
+        $params = array_filter($params, function($details) {
188
+            return !is_null($details['value']);
189 189
         });
190 190
 
191 191
         foreach ($params as $paramName => $details) {
Please login to merge, or discard this patch.
src/Strategies/Metadata/GetFromMiddleware.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
     protected function getScopesInfo($route)
22 22
     {
23 23
         $middlewares = $route->gatherMiddleware();
24
-        $anyScopeMiddleware = collect($middlewares)->first(function ($item) {
24
+        $anyScopeMiddleware = collect($middlewares)->first(function($item) {
25 25
             return preg_match('/^scope:/', $item);
26 26
         });
27 27
         if ($anyScopeMiddleware) {
28 28
             $scopes = explode(',', preg_replace('/^scope:/', '', $anyScopeMiddleware));
29
-            $scopesInfo = Passport::scopes()->filter(function ($item) use ($scopes) {
29
+            $scopesInfo = Passport::scopes()->filter(function($item) use ($scopes) {
30 30
                 return in_array($item->id, $scopes);
31 31
             })->values();
32 32
 
@@ -35,12 +35,12 @@  discard block
 block discarded – undo
35 35
                 'scopes' => $scopesInfo,
36 36
             ];
37 37
         }
38
-        $allScopeMiddleware = collect($middlewares)->first(function ($item) {
38
+        $allScopeMiddleware = collect($middlewares)->first(function($item) {
39 39
             return preg_match('/^scopes:/', $item);
40 40
         });
41 41
         if ($allScopeMiddleware) {
42 42
             $scopes = explode(',', preg_replace('/^scopes:/', '', $allScopeMiddleware));
43
-            $scopesInfo = Passport::scopes()->filter(function ($item) use ($scopes) {
43
+            $scopesInfo = Passport::scopes()->filter(function($item) use ($scopes) {
44 44
                 return in_array($item->id, $scopes);
45 45
             })->values();
46 46
 
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
     protected function getHeaders($route)
57 57
     {
58 58
         $middlewares = $route->gatherMiddleware();
59
-        $authMiddleware = collect($middlewares)->first(function ($item) {
59
+        $authMiddleware = collect($middlewares)->first(function($item) {
60 60
             return preg_match('/^auth:/', $item);
61 61
         });
62 62
         $headers = [];
63 63
         if ($authMiddleware) {
64 64
             $guard = preg_replace('/^auth:/', '', $authMiddleware);
65
-            $driver = config('auth.guards.'.$guard.'.driver');
65
+            $driver = config('auth.guards.' . $guard . '.driver');
66 66
             if ($driver === 'token') {
67 67
                 $headers['Authorization'] = 'Token {token}';
68 68
             } elseif ($driver === 'passport' || $driver === 'jwt') {
Please login to merge, or discard this patch.