protected function prepareResponse($result)
    {
        $this->checkForCurlErrors();

        $response = array();
        $response["data"] = $this->getSerializer()->deserialize($result);
        $response["status"] = $this->getStatusCode();


        if ($response['status'] >= 400 && $response['status'] < 500) {
            $statusCode = $response['status'];
            $exceptionText = "{$statusCode} Client Exception: {$result}";

            throw new ClientErrorException($exceptionText, $statusCode);
        } else if ($response['status'] >= 500) {
            $statusCode = $response['status'];
            $exceptionText = "{$statusCode} Server Exception: {$result}";

            throw new ServerErrorException($exceptionText, $statusCode);
        }

        return $response;
    }
protected function prepareResponse($result)
    {
        $this->checkForCurlErrors();

        $response = array();
        $response["data"] = $this->getSerializer()->deserialize($result);
        $response["status"] = $this->getStatusCode();


        if ($response['status'] >= 400 && $response['status'] < 500) {
            $statusCode = $response['status'];
            $exceptionText = "{$statusCode} Client Exception: {$result}";

            throw new ClientErrorException($exceptionText, $statusCode);
        } else if ($response['status'] >= 500) {
            $statusCode = $response['status'];
            $exceptionText = "{$statusCode} Server Exception: {$result}";

            throw new ServerErrorException($exceptionText, $statusCode);
        }

        return $response;
    }
protected function prepareResponse ( $ result ) { $ this -> checkForCurlErrors ( ) ; $ response = array ( ) ; $ response [ "data" ] = $ this -> getSerializer ( ) -> deserialize ( $ result ) ; $ response [ "status" ] = $ this -> getStatusCode ( ) ; if ( $ response [ 'status' ] >= 400 && $ response [ 'status' ] < 500 ) { $ statusCode = $ response [ 'status' ] ; $ exceptionText = "{$statusCode} Client Exception: {$result}" ; throw new ClientErrorException ( $ exceptionText , $ statusCode ) ; } else if ( $ response [ 'status' ] >= 500 ) { $ statusCode = $ response [ 'status' ] ; $ exceptionText = "{$statusCode} Server Exception: {$result}" ; throw new ServerErrorException ( $ exceptionText , $ statusCode ) ; } return $ response ; }
prepares the response

@param string $result the curl result

@return array
@throws ClientErrorException
@throws ConnectionException
@throws ServerErrorException
prepares the response