Skip to content

Instantly share code, notes, and snippets.

@PeeHaa
Created June 29, 2017 14:53
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
v1 vs v2
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);
}
}
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