Completed
Pull Request — master (#457)
by
unknown
01:36
created
src/Postman/CollectionWriter.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -90,6 +90,9 @@
 block discarded – undo
90 90
         return config('apidoc.postman.excluded_headers', []);
91 91
     }
92 92
 
93
+    /**
94
+     * @param string $mode
95
+     */
93 96
     protected function getRequest($route, $mode)
94 97
     {
95 98
         return [
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -97,12 +97,12 @@  discard block
 block discarded – undo
97 97
             'auth' => $route['authenticated'] ? [
98 98
                 'type' => 'bearer',
99 99
                 'bearer' => [
100
-                    'token' => '{{'.$this->getAccessTokenVariable().'}}',
100
+                    'token' => '{{' . $this->getAccessTokenVariable() . '}}',
101 101
                 ],
102 102
             ] : false,
103 103
             'url' => $this->getRouteUri($route),
104 104
             'method' => $route['methods'][0],
105
-            'header' => collect($route['headers'])->map(function ($header, $key) use ($route) {
105
+            'header' => collect($route['headers'])->map(function($header, $key) use ($route) {
106 106
                 if (in_array($key, $this->getExcludingHeaders())) {
107 107
                     return;
108 108
                 }
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
             })->filter()->values()->toArray(),
117 117
             'body' => [
118 118
                 'mode' => $mode,
119
-                $mode => collect($route['bodyParameters'])->map(function ($parameter, $key) {
119
+                $mode => collect($route['bodyParameters'])->map(function($parameter, $key) {
120 120
                     return [
121 121
                         'key' => $key,
122 122
                         'value' => isset($parameter['value']) ? ($parameter['type'] === 'boolean' ? (string) $parameter['value'] : $parameter['value']) : '',
@@ -137,17 +137,17 @@  discard block
 block discarded – undo
137 137
         $collection = [
138 138
             'variables' => [],
139 139
             'info' => [
140
-                'name' => config('apidoc.postman.name') ?: config('app.name').' API',
140
+                'name' => config('apidoc.postman.name') ?: config('app.name') . ' API',
141 141
                 '_postman_id' => Uuid::uuid4()->toString(),
142 142
                 'description' => config('apidoc.postman.description') ?: '',
143 143
                 'schema' => 'https://schema.getpostman.com/json/collection/v2.0.0/collection.json',
144 144
             ],
145
-            'item' => $this->routeGroups->map(function ($routes, $group) {
145
+            'item' => $this->routeGroups->map(function($routes, $group) {
146 146
                 list($groupName, $groupDescription) = explode("\n\n", $group);
147 147
                 return [
148 148
                     'name' => $groupName,
149 149
                     'description' => $groupDescription,
150
-                    'item' => $routes->map(function ($route) {
150
+                    'item' => $routes->map(function($route) {
151 151
                         $mode = $route['methods'][0] === 'PUT' ? 'urlencoded' : 'formdata';
152 152
 
153 153
                         return [
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
                                     'exec' => [
160 160
                                         'var response = JSON.parse(responseBody);',
161 161
                                         'tests["Successful request"] = responseCode.code === 200;',
162
-                                        'if (response.'.$this->getResponseAccessTokenKey().') { postman.setEnvironmentVariable("'.$this->getAccessTokenVariable().'", response.'.$this->getResponseAccessTokenKey().'); }',
163
-                                        'if (response.'.$this->getResponseRefreshTokenKey().') { postman.setEnvironmentVariable("'.$this->getRefreshTokenVariable().'", response.'.$this->getResponseRefreshTokenKey().'); }',
162
+                                        'if (response.' . $this->getResponseAccessTokenKey() . ') { postman.setEnvironmentVariable("' . $this->getAccessTokenVariable() . '", response.' . $this->getResponseAccessTokenKey() . '); }',
163
+                                        'if (response.' . $this->getResponseRefreshTokenKey() . ') { postman.setEnvironmentVariable("' . $this->getRefreshTokenVariable() . '", response.' . $this->getResponseRefreshTokenKey() . '); }',
164 164
                                     ],
165 165
                                     'type' => 'text/javascript',
166 166
                                 ] : [],
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
                                     'status' => $route['response'][0]['statusText'],
174 174
                                     'code' => $route['response'][0]['status'],
175 175
                                     '_postman_previewlanguage' => 'json',
176
-                                    'header' => collect($route['response'][0]['headers'])->map(function ($header, $key) use ($route) {
176
+                                    'header' => collect($route['response'][0]['headers'])->map(function($header, $key) use ($route) {
177 177
                                         return [
178 178
                                             'key' => $key,
179 179
                                             'name' => $key,
Please login to merge, or discard this patch.
src/Tools/ResponseResolver.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,8 +48,8 @@
 block discarded – undo
48 48
             /** @var Response[]|null $response */
49 49
             $responses = $strategy($this->route, $tags, $routeProps);
50 50
 
51
-            if (! is_null($responses)) {
52
-                return array_map(function (Response $response) {
51
+            if (!is_null($responses)) {
52
+                return array_map(function(Response $response) {
53 53
                     return [
54 54
                         'headers' => $response->headers,
55 55
                         'statusText' => Response::$statusTexts[$response->getStatusCode()],
Please login to merge, or discard this patch.