@@ 21-25 (lines=5) @@ | ||
18 | public function hydrate(ResponseInterface $response, $class = null) |
|
19 | { |
|
20 | $body = $response->getBody()->__toString(); |
|
21 | if (strpos($response->getHeaderLine('Content-Type'), 'application/json') !== 0) { |
|
22 | $message = 'The ArrayHydrator cannot hydrate response with Content-Type: '; |
|
23 | ||
24 | throw new HydrationException($message . $response->getHeaderLine('Content-Type')); |
|
25 | } |
|
26 | ||
27 | $content = \json_decode($body, true); |
|
28 | if (JSON_ERROR_NONE !== \json_last_error()) { |
@@ 28-31 (lines=4) @@ | ||
25 | } |
|
26 | ||
27 | $body = $response->getBody()->__toString(); |
|
28 | if (\strpos($response->getHeaderLine('Content-Type'), 'application/json') !== 0) { |
|
29 | $message = 'The ModelHydrator cannot hydrate response with Content-Type: '; |
|
30 | throw new HydrationException($message . $response->getHeaderLine('Content-Type')); |
|
31 | } |
|
32 | ||
33 | $data = \json_decode($body, true); |
|
34 | if (\JSON_ERROR_NONE !== \json_last_error()) { |