src/Util/Json.php
public static function decode(ResponseInterface $response): array
    {
        $contents = $response->getBody()->getContents();
        $decoded = json_decode($contents, true);
        $response->getBody()->rewind();

        if (json_last_error() !== JSON_ERROR_NONE || ! is_array($decoded)) {
            throw new JsonException(json_last_error_msg());
        }

        return $decoded;
    }
public static function decode(ResponseInterface $response): array
    {
        $contents = $response->getBody()->getContents();
        $decoded = json_decode($contents, true);
        $response->getBody()->rewind();

        if (json_last_error() !== JSON_ERROR_NONE || ! is_array($decoded)) {
            throw new JsonException(json_last_error_msg());
        }

        return $decoded;
    }
public static function decode ( ResponseInterface $ response ) : array { $ contents = $ response -> getBody ( ) -> getContents ( ) ; $ decoded = json_decode ( $ contents , true ) ; $ response -> getBody ( ) -> rewind ( ) ; if ( json_last_error ( ) !== JSON_ERROR_NONE || ! is_array ( $ decoded ) ) { throw new JsonException ( json_last_error_msg ( ) ) ; } return $ decoded ; }
Json decode an http response.

@param  \Psr\Http\Message\ResponseInterface $response
@return array
@throws \DevMob\Postcodes\Exceptions\JsonException
Json decode an http response .