diff --git a/README.md b/README.md index b3e0622..e05b0bd 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,7 @@ $client->singleCall("GET", $guzzleParameterArray); ## Changelog +* 0.1.15 Enable returning PDFs (thx ewaldmedia) * 0.1.14 Add _short period write limit reached_ error handling (thx resslinger) * 0.1.13 Change from [Laravels `str_contains`](https://github.com/laravel/framework/blob/8.x/src/Illuminate/Support/Str.php#L181) to [PHPs `stripos()`](https://www.php.net/manual/de/function.stripos.php) because [it doesn't require `ext-mbstring`](https://github.com/repat/plentymarkets-rest-client/pull/16#issuecomment-880731813) (thx DanMan) * 0.1.12 Remove `danielstjules/stringy` dependency, copy over [Laravels `str_contains`](https://github.com/laravel/framework/blob/8.x/src/Illuminate/Support/Str.php#L181) instead diff --git a/composer.json b/composer.json index e085e8f..c75e372 100644 --- a/composer.json +++ b/composer.json @@ -5,24 +5,12 @@ "keywords": ["plentymarkets", "pm", "rest", "api", "client", "sdk"], "homepage": "https://github.com/repat/plentymarkets-rest-client", "license": "MIT", - "version" : "0.1.14", + "version" : "0.1.15", "authors": [ { "name": "repat", "email": "repat@repat.de", "role": "Developer" - }, - { - "name": "hepisec", - "role": "Contributor" - }, - { - "name": "daniel-mannheimer", - "role": "Contributor" - }, - { - "name": "fwehrhausen", - "role": "Contributor" } ], "require": { diff --git a/src/PlentymarketsRestClient/PlentymarketsRestClient.php b/src/PlentymarketsRestClient/PlentymarketsRestClient.php index 8d30f04..c06034c 100644 --- a/src/PlentymarketsRestClient/PlentymarketsRestClient.php +++ b/src/PlentymarketsRestClient/PlentymarketsRestClient.php @@ -115,11 +115,16 @@ public function singleCall($method, $path, $params = []) $this->handleRateLimiting($response); } - if($response->getHeaders()['Content-Type'][0] == 'application/pdf'){ + $headers = $response->getHeaders(); + + if (is_array($headers) + && array_key_exists('Content-Type', $headers) + && array_key_exists(0, $headers['Content-Type']) + && $headers['Content-Type'][0] === 'application/pdf') { return $response->getBody()->getContents(); - }else{ - return json_decode($response->getBody(), true); } + + return json_decode($response->getBody(), true); } public function get($path, $array = [])