Skip to content

Commit 721f194

Browse files
committed
Refactor code to use hasHeader & getHeader methods
1 parent 9c5af0b commit 721f194

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/Api/ProductMediaFileApi.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,12 @@ public function download(string $code): ResponseInterface
130130
*/
131131
protected function extractCodeFromCreationResponse(ResponseInterface $response)
132132
{
133-
$headers = $response->getHeaders();
134-
135-
if (isset($headers['Location'][0])) {
136-
$locationHeader = $headers['Location'][0];
133+
if ($response->hasHeader('Location')) {
134+
$locationHeader = $response->getHeader('Location')[0];
137135
}
138136

139-
if (isset($headers['location'][0])) {
140-
$locationHeader = $headers['location'][0];
137+
if ($response->hasHeader('location')) {
138+
$locationHeader = $response->getHeader('location')[0];
141139
}
142140

143141
if (!isset($locationHeader)) {

0 commit comments

Comments
 (0)