public function deserialize(ResponseInterface $response, $class)
{
$body = $response->getBody()->__toString();
if (strpos($response->getHeaderLine('Content-Type'), 'application/json') !== 0) {
throw new DeserializeException('The ArrayDeserializer cannot deserialize response with Content-Type:' . $response->getHeaderLine('Content-Type'));
}
$content = json_decode($body, true);
if (JSON_ERROR_NONE !== json_last_error()) {
throw new DeserializeException(sprintf('Error (%d) when trying to json_decode response', json_last_error()));
}
return $content;
}