| @@ 25-27 (lines=3) @@ | ||
| 22 | public function hydrate(ResponseInterface $response, string $class): array |
|
| 23 | { |
|
| 24 | $body = $response->getBody()->__toString(); |
|
| 25 | if (strpos($response->getHeaderLine('Content-Type'), 'application/json') !== 0) { |
|
| 26 | throw new HydrationException('The ArrayHydrator cannot hydrate response with Content-Type:'.$response->getHeaderLine('Content-Type')); |
|
| 27 | } |
|
| 28 | ||
| 29 | $content = json_decode($body, true); |
|
| 30 | if (JSON_ERROR_NONE !== json_last_error()) { |
|
| @@ 24-26 (lines=3) @@ | ||
| 21 | public function hydrate(ResponseInterface $response, string $class) |
|
| 22 | { |
|
| 23 | $body = (string) $response->getBody(); |
|
| 24 | if (strpos($response->getHeaderLine('Content-Type'), 'application/json') !== 0) { |
|
| 25 | throw new HydrationException('The ModelHydrator cannot hydrate response with Content-Type:'.$response->getHeaderLine('Content-Type')); |
|
| 26 | } |
|
| 27 | ||
| 28 | $data = json_decode($body, true); |
|
| 29 | if (JSON_ERROR_NONE !== json_last_error()) { |
|