Completed
Pull Request — master (#384)
by
unknown
01:45
created
src/Tools/ResponseResolver.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -37,6 +37,9 @@
 block discarded – undo
37 37
         }
38 38
     }
39 39
 
40
+    /**
41
+     * @param Route $route
42
+     */
40 43
     public static function getResponse($route, $tags, $routeProps)
41 44
     {
42 45
         return (new static($route))->resolve($tags, $routeProps);
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
         foreach (static::$strategies as $strategy) {
32 32
             $strategy = new $strategy();
33 33
             $response = $strategy($this->route, $tags, $routeProps);
34
-            if (! is_null($response)) {
34
+            if (!is_null($response)) {
35 35
                 return $this->getResponseContent($response);
36 36
             }
37 37
         }
Please login to merge, or discard this patch.
src/Tools/ResponseStrategies/ResponseCallStrategy.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
      * @param Route $route
64 64
      * @param array $bindings
65 65
      *
66
-     * @return mixed
66
+     * @return string
67 67
      */
68 68
     protected function replaceUrlParameterBindings(Route $route, $bindings)
69 69
     {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
     public function __invoke(Route $route, array $tags, array $routeProps)
16 16
     {
17 17
         $rulesToApply = $routeProps['rules']['response_calls'] ?? [];
18
-        if (! $this->shouldMakeApiCall($route, $rulesToApply)) {
18
+        if (!$this->shouldMakeApiCall($route, $rulesToApply)) {
19 19
             return;
20 20
         }
21 21
 
@@ -124,14 +124,14 @@  discard block
 block discarded – undo
124 124
         // set URL and query parameters
125 125
         $uri = $request->getRequestUri();
126 126
         $query = $request->getQueryString();
127
-        if (! empty($query)) {
127
+        if (!empty($query)) {
128 128
             $uri .= "?$query";
129 129
         }
130 130
         $response = call_user_func_array([$dispatcher, strtolower($request->method())], [$uri]);
131 131
 
132 132
         // the response from the Dingo dispatcher is the 'raw' response from the controller,
133 133
         // so we have to ensure it's JSON first
134
-        if (! $response instanceof Response) {
134
+        if (!$response instanceof Response) {
135 135
             $response = response()->json($response);
136 136
         }
137 137
 
@@ -238,8 +238,8 @@  discard block
 block discarded – undo
238 238
         $prefix = 'HTTP_';
239 239
         foreach ($headers as $name => $value) {
240 240
             $name = strtr(strtoupper($name), '-', '_');
241
-            if (! starts_with($name, $prefix) && $name !== 'CONTENT_TYPE') {
242
-                $name = $prefix.$name;
241
+            if (!starts_with($name, $prefix) && $name !== 'CONTENT_TYPE') {
242
+                $name = $prefix . $name;
243 243
             }
244 244
             $server[$name] = $value;
245 245
         }
Please login to merge, or discard this patch.
src/Tools/Generator.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         ]);
56 56
 
57 57
         $parsedRoute = [
58
-            'id' => md5($this->getUri($route).':'.implode($this->getMethods($route))),
58
+            'id' => md5($this->getUri($route) . ':' . implode($this->getMethods($route))),
59 59
             'group' => $routeGroup,
60 60
             'title' => $docBlock['short'],
61 61
             'description' => $docBlock['long'],
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
             'queryParameters' => $queryParameters,
66 66
             'authenticated' => $this->getAuthStatusFromDocBlock($docBlock['tags']),
67 67
             'response' => $content,
68
-            'showresponse' => ! empty($content),
68
+            'showresponse' => !empty($content),
69 69
         ];
70 70
         $parsedRoute['headers'] = $rulesToApply['headers'] ?? [];
71 71
 
@@ -80,10 +80,10 @@  discard block
 block discarded – undo
80 80
     protected function getBodyParametersFromDocBlock(array $tags)
81 81
     {
82 82
         $parameters = collect($tags)
83
-            ->filter(function ($tag) {
83
+            ->filter(function($tag) {
84 84
                 return $tag instanceof Tag && $tag->getName() === 'bodyParam';
85 85
             })
86
-            ->mapWithKeys(function ($tag) {
86
+            ->mapWithKeys(function($tag) {
87 87
                 preg_match('/(.+?)\s+(.+?)\s+(required\s+)?(.*)/', $tag->getContent(), $content);
88 88
                 if (empty($content)) {
89 89
                     // this means only name and type were supplied
@@ -117,10 +117,10 @@  discard block
 block discarded – undo
117 117
     protected function getQueryParametersFromDocBlock(array $tags)
118 118
     {
119 119
         $parameters = collect($tags)
120
-            ->filter(function ($tag) {
120
+            ->filter(function($tag) {
121 121
                 return $tag instanceof Tag && $tag->getName() === 'queryParam';
122 122
             })
123
-            ->mapWithKeys(function ($tag) {
123
+            ->mapWithKeys(function($tag) {
124 124
                 preg_match('/(.+?)\s+(required\s+)?(.*)/', $tag->getContent(), $content);
125 125
                 if (empty($content)) {
126 126
                     // this means only name was supplied
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
     protected function getAuthStatusFromDocBlock(array $tags)
158 158
     {
159 159
         $authTag = collect($tags)
160
-            ->first(function ($tag) {
160
+            ->first(function($tag) {
161 161
                 return $tag instanceof Tag && strtolower($tag->getName()) === 'authenticated';
162 162
             });
163 163
 
@@ -228,25 +228,25 @@  discard block
 block discarded – undo
228 228
     {
229 229
         $faker = Factory::create();
230 230
         $fakes = [
231
-            'integer' => function () {
231
+            'integer' => function() {
232 232
                 return rand(1, 20);
233 233
             },
234
-            'number' => function () use ($faker) {
234
+            'number' => function() use ($faker) {
235 235
                 return $faker->randomFloat();
236 236
             },
237
-            'float' => function () use ($faker) {
237
+            'float' => function() use ($faker) {
238 238
                 return $faker->randomFloat();
239 239
             },
240
-            'boolean' => function () use ($faker) {
240
+            'boolean' => function() use ($faker) {
241 241
                 return $faker->boolean();
242 242
             },
243
-            'string' => function () use ($faker) {
243
+            'string' => function() use ($faker) {
244 244
                 return str_random();
245 245
             },
246
-            'array' => function () {
246
+            'array' => function() {
247 247
                 return '[]';
248 248
             },
249
-            'object' => function () {
249
+            'object' => function() {
250 250
                 return '{}';
251 251
             },
252 252
         ];
Please login to merge, or discard this patch.