Code Duplication    Length = 4-5 lines in 2 locations

src/Common/Hydrator/ArrayHydrator.php 1 location

@@ 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()) {

src/Common/Hydrator/ModelHydrator.php 1 location

@@ 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()) {