Allow json decode of received campaigns response

The body is an instance of a stream.
Therefore we need to cast so string before passing to json_decode.
That's necessary because strict_types are forced.
This commit is contained in:
Daniel Siepmann 2021-01-22 11:06:27 +01:00
parent adec8fd806
commit 4741df6803
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4

View file

@ -71,7 +71,7 @@ class Campaigns
if ($result->getStatusCode() !== 200) {
throw new \Exception('API key or user invalid.', 1605878128);
}
$body = json_decode($result->getBody(), true);
$body = json_decode((string) $result->getBody(), true);
$campaigns = [];
foreach ($body['Campaigns'] as $campaign) {
$campaigns[] = new Campaign($campaign, $this->settings);