Completed
Pull Request — master (#666)
by Guy
02:18 queued 34s
created
src/Writing/PostmanCollectionWriter.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
         $collection = [
48 48
             'variables' => [],
49 49
             'info' => [
50
-                'name' => config('apidoc.postman.name') ?: config('app.name').' API',
50
+                'name' => config('apidoc.postman.name') ?: config('app.name') . ' API',
51 51
                 '_postman_id' => Uuid::uuid4()->toString(),
52 52
                 'description' => config('apidoc.postman.description') ?: '',
53 53
                 'schema' => 'https://schema.getpostman.com/json/collection/v2.0.0/collection.json',
54 54
             ],
55
-            'item' => $this->routeGroups->map(function (Collection $routes, $groupName) {
55
+            'item' => $this->routeGroups->map(function(Collection $routes, $groupName) {
56 56
                 return [
57 57
                     'name' => $groupName,
58 58
                     'description' => $routes->first()['metadata']['groupDescription'],
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
             })->values()->toArray(),
62 62
         ];
63 63
 
64
-        if (! empty($this->auth)) {
64
+        if (!empty($this->auth)) {
65 65
             $collection['auth'] = $this->auth;
66 66
         }
67 67
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 
97 97
         // Exclude authentication headers if they're handled by Postman auth
98 98
         $authHeader = $this->getAuthHeader();
99
-        if (! empty($authHeader)) {
99
+        if (!empty($authHeader)) {
100 100
             $headers = $headers->except($authHeader);
101 101
         }
102 102
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
             ->union([
105 105
                 'Accept' => 'application/json',
106 106
             ])
107
-            ->map(function ($value, $header) {
107
+            ->map(function($value, $header) {
108 108
                 return [
109 109
                     'key' => $header,
110 110
                     'value' => $value,
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
 
117 117
     protected function makeUrlData($route)
118 118
     {
119
-        [$urlParams, $queryParams] = collect($route['urlParameters'])->partition(function ($_, $key) use ($route) {
120
-            return Str::contains($route['uri'], '{'.$key.'}');
119
+        [$urlParams, $queryParams] = collect($route['urlParameters'])->partition(function($_, $key) use ($route) {
120
+            return Str::contains($route['uri'], '{' . $key . '}');
121 121
         });
122 122
 
123 123
         /** @var Collection $queryParams */
@@ -125,16 +125,16 @@  discard block
 block discarded – undo
125 125
             'protocol' => $this->protocol,
126 126
             'host' => $this->baseUrl,
127 127
             // Substitute laravel/symfony query params ({example}) to Postman style, prefixed with a colon
128
-            'path' => preg_replace_callback('/\/{(\w+)\??}(?=\/|$)/', function ($matches) {
129
-                return '/:'.$matches[1];
128
+            'path' => preg_replace_callback('/\/{(\w+)\??}(?=\/|$)/', function($matches) {
129
+                return '/:' . $matches[1];
130 130
             }, $route['uri']),
131
-            'query' => $queryParams->union($route['queryParameters'])->map(function ($parameter, $key) {
131
+            'query' => $queryParams->union($route['queryParameters'])->map(function($parameter, $key) {
132 132
                 return [
133 133
                     'key' => $key,
134 134
                     'value' => $parameter['value'],
135 135
                     'description' => $parameter['description'],
136 136
                     // Default query params to disabled if they aren't required and have empty values
137
-                    'disabled' => ! $parameter['required'] && empty($parameter['value']),
137
+                    'disabled' => !$parameter['required'] && empty($parameter['value']),
138 138
                 ];
139 139
             })->values()->toArray(),
140 140
         ];
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
             return $base;
146 146
         }
147 147
 
148
-        $base['variable'] = $urlParams->map(function ($parameter, $key) {
148
+        $base['variable'] = $urlParams->map(function($parameter, $key) {
149 149
             return [
150 150
                 'id' => $key,
151 151
                 'key' => $key,
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
     protected function getAuthHeader()
161 161
     {
162 162
         $auth = $this->auth;
163
-        if (empty($auth) || ! is_string($auth['type'] ?? null)) {
163
+        if (empty($auth) || !is_string($auth['type'] ?? null)) {
164 164
             return null;
165 165
         }
166 166
 
Please login to merge, or discard this patch.