Skip to content

Commit c8f345c

Browse files
committed
StyleCI linting
1 parent 6770e67 commit c8f345c

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

src/Writing/PostmanCollectionWriter.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ public function getCollection()
6161
})->values()->toArray(),
6262
];
6363

64-
65-
if (!empty($this->auth)) {
64+
if (! empty($this->auth)) {
6665
$collection['auth'] = $this->auth;
6766
}
6867

@@ -74,6 +73,7 @@ protected function generateEndpointItem($route)
7473
$mode = 'raw';
7574

7675
$method = $route['methods'][0];
76+
7777
return [
7878
'name' => $route['metadata']['title'] != '' ? $route['metadata']['title'] : $route['uri'],
7979
'request' => [
@@ -96,7 +96,7 @@ protected function resolveHeadersForRoute($route)
9696

9797
// Exclude authentication headers if they're handled by Postman auth
9898
$authHeader = $this->getAuthHeader();
99-
if (!empty($authHeader)) {
99+
if (! empty($authHeader)) {
100100
$headers = $headers->except($authHeader);
101101
}
102102

@@ -116,8 +116,8 @@ protected function resolveHeadersForRoute($route)
116116

117117
protected function makeUrlData($route)
118118
{
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.'}');
121121
});
122122

123123
/** @var Collection $queryParams */
@@ -126,15 +126,15 @@ protected function makeUrlData($route)
126126
'host' => $this->baseUrl,
127127
// Substitute laravel/symfony query params ({example}) to Postman style, prefixed with a colon
128128
'path' => preg_replace_callback('/\/{(\w+)\??}(?=\/|$)/', function ($matches) {
129-
return '/:' . $matches[1];
129+
return '/:'.$matches[1];
130130
}, $route['uri']),
131131
'query' => $queryParams->union($route['queryParameters'])->map(function ($parameter, $key) {
132132
return [
133133
'key' => $key,
134134
'value' => $parameter['value'],
135135
'description' => $parameter['description'],
136136
// 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']),
138138
];
139139
})->values()->toArray(),
140140
];
@@ -160,7 +160,7 @@ protected function makeUrlData($route)
160160
protected function getAuthHeader()
161161
{
162162
$auth = $this->auth;
163-
if (empty($auth) || !is_string($auth['type'] ?? null)) {
163+
if (empty($auth) || ! is_string($auth['type'] ?? null)) {
164164
return null;
165165
}
166166

tests/Unit/PostmanCollectionWriterTest.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ public function testQueryParametersAreDisabledWithNoValueWhenNotRequired()
217217
'description' => 'A not required param with a null value',
218218
'required' => false,
219219
'value' => null,
220-
]
220+
],
221221
];
222222

223223
$collection = $this->fakeCollection([$fakeRoute]);
@@ -265,12 +265,12 @@ public function provideAuthConfigHeaderData()
265265
{
266266
yield [
267267
['type' => 'bearer', 'bearer' => ['token' => 'Test']],
268-
['Authorization' => 'Bearer Test']
268+
['Authorization' => 'Bearer Test'],
269269
];
270270

271271
yield [
272272
['type' => 'apikey', 'apikey' => ['value' => 'Test', 'key' => 'X-Authorization']],
273-
['X-Authorization' => 'Test']
273+
['X-Authorization' => 'Test'],
274274
];
275275
}
276276

@@ -280,7 +280,7 @@ public function testApiKeyAuthIsIgnoredIfExplicitlyNotInHeader()
280280
'auth' => ['type' => 'apikey', 'apikey' => [
281281
'value' => 'Test',
282282
'key' => 'X-Authorization',
283-
'in' => 'notheader'
283+
'in' => 'notheader',
284284
]],
285285
]);
286286

@@ -292,9 +292,8 @@ public function testApiKeyAuthIsIgnoredIfExplicitlyNotInHeader()
292292

293293
$this->assertContains([
294294
'key' => 'X-Authorization',
295-
'value' => 'Test'
295+
'value' => 'Test',
296296
], data_get($collection, 'item.0.item.0.request.header'));
297-
298297
}
299298

300299
protected function fakeRoute($path, $title = '')

0 commit comments

Comments
 (0)