private function _convertResponseToModel($response, $resourceName)
    {
        if (!is_array($response) || empty($response)) {
            return $response;
        }

        $model = null;
        switch (strtolower($resourceName)) {
            case 'client':
                $model = $this->_createClient($response);
                break;
            case 'payment':
                $model = $this->_createPayment($response);
                break;
            case 'transaction':
                $model = $this->_createTransaction($response);
                break;
            case 'preauthorization':
                if (isset($response['preauthorization'])) {
                    $response = $response['preauthorization'];
                }
                $model = $this->_createPreauthorization($response);
                break;
            case 'refund':
                $model = $this->_createRefund($response);
                break;
            case 'offer':
                $model = $this->_createOffer($response);
                break;
            case 'subscription':
                $model = $this->_createSubscription($response);
                break;
            case 'webhook':
                $model = $this->_createWebhook($response);
                break;
            case 'fraud':
                $model = $this->_createFraud($response);
                break;
            case 'checksum':
                $model = $this->_createChecksum($response);
                break;
            case AbstractAddress::TYPE_SHIPPING:
                $model = $this->_createAddress($response, AbstractAddress::TYPE_SHIPPING);
                break;
            case AbstractAddress::TYPE_BILLING:
                $model = $this->_createAddress($response, AbstractAddress::TYPE_BILLING);
                break;
            case 'item':
                $model = $this->_createItem($response);
                break;
        }

        return $model;
    }
private function _convertResponseToModel($response, $resourceName)
    {
        if (!is_array($response) || empty($response)) {
            return $response;
        }

        $model = null;
        switch (strtolower($resourceName)) {
            case 'client':
                $model = $this->_createClient($response);
                break;
            case 'payment':
                $model = $this->_createPayment($response);
                break;
            case 'transaction':
                $model = $this->_createTransaction($response);
                break;
            case 'preauthorization':
                if (isset($response['preauthorization'])) {
                    $response = $response['preauthorization'];
                }
                $model = $this->_createPreauthorization($response);
                break;
            case 'refund':
                $model = $this->_createRefund($response);
                break;
            case 'offer':
                $model = $this->_createOffer($response);
                break;
            case 'subscription':
                $model = $this->_createSubscription($response);
                break;
            case 'webhook':
                $model = $this->_createWebhook($response);
                break;
            case 'fraud':
                $model = $this->_createFraud($response);
                break;
            case 'checksum':
                $model = $this->_createChecksum($response);
                break;
            case AbstractAddress::TYPE_SHIPPING:
                $model = $this->_createAddress($response, AbstractAddress::TYPE_SHIPPING);
                break;
            case AbstractAddress::TYPE_BILLING:
                $model = $this->_createAddress($response, AbstractAddress::TYPE_BILLING);
                break;
            case 'item':
                $model = $this->_createItem($response);
                break;
        }

        return $model;
    }
private function _convertResponseToModel ( $ response , $ resourceName ) { if ( ! is_array ( $ response ) || empty ( $ response ) ) { return $ response ; } $ model = null ; switch ( strtolower ( $ resourceName ) ) { case 'client' : $ model = $ this -> _createClient ( $ response ) ; break ; case 'payment' : $ model = $ this -> _createPayment ( $ response ) ; break ; case 'transaction' : $ model = $ this -> _createTransaction ( $ response ) ; break ; case 'preauthorization' : if ( isset ( $ response [ 'preauthorization' ] ) ) { $ response = $ response [ 'preauthorization' ] ; } $ model = $ this -> _createPreauthorization ( $ response ) ; break ; case 'refund' : $ model = $ this -> _createRefund ( $ response ) ; break ; case 'offer' : $ model = $ this -> _createOffer ( $ response ) ; break ; case 'subscription' : $ model = $ this -> _createSubscription ( $ response ) ; break ; case 'webhook' : $ model = $ this -> _createWebhook ( $ response ) ; break ; case 'fraud' : $ model = $ this -> _createFraud ( $ response ) ; break ; case 'checksum' : $ model = $ this -> _createChecksum ( $ response ) ; break ; case AbstractAddress :: TYPE_SHIPPING : $ model = $ this -> _createAddress ( $ response , AbstractAddress :: TYPE_SHIPPING ) ; break ; case AbstractAddress :: TYPE_BILLING : $ model = $ this -> _createAddress ( $ response , AbstractAddress :: TYPE_BILLING ) ; break ; case 'item' : $ model = $ this -> _createItem ( $ response ) ; break ; } return $ model ; }
Creates an object from a response array based on the call-context
@param array $response Response from any Request
@param string $resourceName
@return Base
Creates an object from a response array based on the call - context