Created
June 29, 2017 14:53
-
-
Save PeeHaa/f67163c64b2a797ee388fb13535130d5 to your computer and use it in GitHub Desktop.
v1 vs v2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function appendResponse(Response $response) | |
{ | |
try { | |
$events = \json_try_decode($response->getBody(), true); | |
} catch (DecodeErrorException $e) { | |
$this->logger->emergency('Failed to decode response body as JSON', ['exception' => $e]); | |
throw new DecodingFailedException('Failed to decode response body as JSON', $e->getCode(), $e); | |
} | |
foreach ($events as $event) { | |
$this->appendEvent($event); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function appendResponse(Response $response) | |
{ | |
try { | |
$events = \json_try_decode(yield $response->getBody()->read(), true); | |
} catch (DecodeErrorException $e) { | |
$this->logger->emergency('Failed to decode response body as JSON', ['exception' => $e]); | |
throw new DecodingFailedException('Failed to decode response body as JSON', $e->getCode(), $e); | |
} | |
foreach ($events as $event) { | |
$this->appendEvent($event); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment