src/Hydrator/ArrayHydrator.php 1 location
|
@@ 31-33 (lines=3) @@
|
| 28 |
|
public function hydrate(ResponseInterface $response, string $class): array |
| 29 |
|
{ |
| 30 |
|
$body = $response->getBody()->__toString(); |
| 31 |
|
if (strpos($response->getHeaderLine('Content-Type'), 'application/json') !== 0) { |
| 32 |
|
throw new HydrationException('The ArrayHydrator cannot hydrate response with Content-Type:'.$response->getHeaderLine('Content-Type')); |
| 33 |
|
} |
| 34 |
|
|
| 35 |
|
$content = json_decode($body, true); |
| 36 |
|
if (JSON_ERROR_NONE !== json_last_error()) { |
src/Hydrator/ModelHydrator.php 1 location
|
@@ 32-34 (lines=3) @@
|
| 29 |
|
public function hydrate(ResponseInterface $response, string $class) |
| 30 |
|
{ |
| 31 |
|
$body = $response->getBody()->__toString(); |
| 32 |
|
if (strpos($response->getHeaderLine('Content-Type'), 'application/json') !== 0) { |
| 33 |
|
throw new HydrationException('The ModelHydrator cannot hydrate response with Content-Type:'.$response->getHeaderLine('Content-Type')); |
| 34 |
|
} |
| 35 |
|
|
| 36 |
|
$data = json_decode($body, true); |
| 37 |
|
if (JSON_ERROR_NONE !== json_last_error()) { |