src/vendor/stripe/stripe-php/lib/Util/Util.php
/**
     * Converts a response from the Stripe API to the corresponding PHP object.
     *
     * @param array $resp The response from the Stripe API.
     * @param array $opts
     * @return Object|array
     */
Converts a response from the Stripe API to the corresponding PHP object.
@param array $resp The response from the Stripe API.
@param array $opts
@return Object|array
Converts a response from the Stripe API to the corresponding PHP object . @param array $resp The response from the Stripe API . @param array $opts @return Object|array
public static function convertToStripeObject($resp, $opts)
    {
        $types = array(
            'account' => 'Stripe\\Account',
            'alipay_account' => 'Stripe\\AlipayAccount',
            'bank_account' => 'Stripe\\BankAccount',
            'balance_transaction' => 'Stripe\\BalanceTransaction',
            'card' => 'Stripe\\Card',
            'charge' => 'Stripe\\Charge',
            'coupon' => 'Stripe\\Coupon',
            'customer' => 'Stripe\\Customer',
            'list' => 'Stripe\\Collection',
            'invoice' => 'Stripe\\Invoice',
            'invoiceitem' => 'Stripe\\InvoiceItem',
            'event' => 'Stripe\\Event',
            'file' => 'Stripe\\FileUpload',
            'token' => 'Stripe\\Token',
            'transfer' => 'Stripe\\Transfer',
            'plan' => 'Stripe\\Plan',
            'recipient' => 'Stripe\\Recipient',
            'refund' => 'Stripe\\Refund',
            'subscription' => 'Stripe\\Subscription',
            'fee_refund' => 'Stripe\\ApplicationFeeRefund',
            'bitcoin_receiver' => 'Stripe\\BitcoinReceiver',
            'bitcoin_transaction' => 'Stripe\\BitcoinTransaction',
        );
        if (self::isList($resp)) {
            $mapped = array();
            foreach ($resp as $i) {
                array_push($mapped, self::convertToStripeObject($i, $opts));
            }
            return $mapped;
        } elseif (is_array($resp)) {
            if (isset($resp['object']) && is_string($resp['object']) && isset($types[$resp['object']])) {
                $class = $types[$resp['object']];
            } else {
                $class = 'Stripe\\Object';
            }
            return $class::constructFrom($resp, $opts);
        } else {
            return $resp;
        }
    }
public static function convertToStripeObject ( $ resp , $ opts ) { $ types = array ( 'account' => 'Stripe\\Account' , 'alipay_account' => 'Stripe\\AlipayAccount' , 'bank_account' => 'Stripe\\BankAccount' , 'balance_transaction' => 'Stripe\\BalanceTransaction' , 'card' => 'Stripe\\Card' , 'charge' => 'Stripe\\Charge' , 'coupon' => 'Stripe\\Coupon' , 'customer' => 'Stripe\\Customer' , 'list' => 'Stripe\\Collection' , 'invoice' => 'Stripe\\Invoice' , 'invoiceitem' => 'Stripe\\InvoiceItem' , 'event' => 'Stripe\\Event' , 'file' => 'Stripe\\FileUpload' , 'token' => 'Stripe\\Token' , 'transfer' => 'Stripe\\Transfer' , 'plan' => 'Stripe\\Plan' , 'recipient' => 'Stripe\\Recipient' , 'refund' => 'Stripe\\Refund' , 'subscription' => 'Stripe\\Subscription' , 'fee_refund' => 'Stripe\\ApplicationFeeRefund' , 'bitcoin_receiver' => 'Stripe\\BitcoinReceiver' , 'bitcoin_transaction' => 'Stripe\\BitcoinTransaction' , ) ; if ( self :: isList ( $ resp ) ) { $ mapped = array ( ) ; foreach ( $ resp as $ i ) { array_push ( $ mapped , self :: convertToStripeObject ( $ i , $ opts ) ) ; } return $ mapped ; } elseif ( is_array ( $ resp ) ) { if ( isset ( $ resp [ 'object' ] ) && is_string ( $ resp [ 'object' ] ) && isset ( $ types [ $ resp [ 'object' ] ] ) ) { $ class = $ types [ $ resp [ 'object' ] ] ; } else { $ class = 'Stripe\\Object' ; } return $ class :: constructFrom ( $ resp , $ opts ) ; } else { return $ resp ; } }
Converts a response from the Stripe API to the corresponding PHP object.
Converts a response from the Stripe API to the corresponding PHP object .