public static function getContent(ResponseInterface $response)
    {
        if ($response->getStatusCode() === 204) {
            return [];
        }

        $body = (string) $response->getBody();

        if (!$body) {
            return [];
        }

        if (strpos($response->getHeaderLine('Content-Type'), 'application/json') !== 0) {
            throw new DecodingFailedException('The content type header was not application/json.');
        }

        return self::jsonDecode($body);
    }
public static function getContent(ResponseInterface $response)
    {
        if ($response->getStatusCode() === 204) {
            return [];
        }

        $body = (string) $response->getBody();

        if (!$body) {
            return [];
        }

        if (strpos($response->getHeaderLine('Content-Type'), 'application/json') !== 0) {
            throw new DecodingFailedException('The content type header was not application/json.');
        }

        return self::jsonDecode($body);
    }
public static function getContent ( ResponseInterface $ response ) { if ( $ response -> getStatusCode ( ) === 204 ) { return [ ] ; } $ body = ( string ) $ response -> getBody ( ) ; if ( ! $ body ) { return [ ] ; } if ( strpos ( $ response -> getHeaderLine ( 'Content-Type' ) , 'application/json' ) !== 0 ) { throw new DecodingFailedException ( 'The content type header was not application/json.' ) ; } return self :: jsonDecode ( $ body ) ; }
Get the decoded response content.

If the there is no response body, we will always return the empty array.

@param \Psr\Http\Message\ResponseInterface $response

@throws \Bitbucket\Exception\DecodingFailedException

@return array
Get the decoded response content .