src/Api/Response.php
public static function create(\GuzzleHttp\Psr7\Response $response)
    {
        // - validate body
        $data = json_decode($response->getBody(), true, 512, JSON_BIGINT_AS_STRING);
        if (empty($data)) {
            throw new ApiException('Invalid response body');
        }
        // - validate internal data
        if (isset($data['status'])) {
            if ($data['status'] != 0) {
                throw new ApiException('Remote error: ' .
                    (isset($data['status_message']) ? $data['status_message'] : '-'),
                    $data['status']);
            }
            $item = new self();
            $item->data = $data;
            return $item;
        }
        throw new ApiException('Invalid response json');
    }
public static function create(\GuzzleHttp\Psr7\Response $response)
    {
        // - validate body
        $data = json_decode($response->getBody(), true, 512, JSON_BIGINT_AS_STRING);
        if (empty($data)) {
            throw new ApiException('Invalid response body');
        }
        // - validate internal data
        if (isset($data['status'])) {
            if ($data['status'] != 0) {
                throw new ApiException('Remote error: ' .
                    (isset($data['status_message']) ? $data['status_message'] : '-'),
                    $data['status']);
            }
            $item = new self();
            $item->data = $data;
            return $item;
        }
        throw new ApiException('Invalid response json');
    }
public static function create ( \ GuzzleHttp \ Psr7 \ Response $ response ) { // - validate body $ data = json_decode ( $ response -> getBody ( ) , true , 512 , JSON_BIGINT_AS_STRING ) ; if ( empty ( $ data ) ) { throw new ApiException ( 'Invalid response body' ) ; } // - validate internal data if ( isset ( $ data [ 'status' ] ) ) { if ( $ data [ 'status' ] != 0 ) { throw new ApiException ( 'Remote error: ' . ( isset ( $ data [ 'status_message' ] ) ? $ data [ 'status_message' ] : '-' ) , $ data [ 'status' ] ) ; } $ item = new self ( ) ; $ item -> data = $ data ; return $ item ; } throw new ApiException ( 'Invalid response json' ) ; }
Create api response from http-response

@param  \GuzzleHttp\Psr7\Response $response network response
@return \Viber\Api\Response
@throws \Viber\Api\Exception\ApiException
Create api response from http - response