public static function convertToStripeObject($resp, $opts)
{
$types = array('account' => 'Stripe\\Account', 'alipay_account' => 'Stripe\\AlipayAccount', 'apple_pay_domain' => 'Stripe\\ApplePayDomain', 'bank_account' => 'Stripe\\BankAccount', 'balance_transaction' => 'Stripe\\BalanceTransaction', 'card' => 'Stripe\\Card', 'charge' => 'Stripe\\Charge', 'country_spec' => 'Stripe\\CountrySpec', 'coupon' => 'Stripe\\Coupon', 'customer' => 'Stripe\\Customer', 'dispute' => 'Stripe\\Dispute', 'list' => 'Stripe\\Collection', 'invoice' => 'Stripe\\Invoice', 'invoiceitem' => 'Stripe\\InvoiceItem', 'event' => 'Stripe\\Event', 'file' => 'Stripe\\FileUpload', 'token' => 'Stripe\\Token', 'transfer' => 'Stripe\\Transfer', 'transfer_reversal' => 'Stripe\\TransferReversal', 'order' => 'Stripe\\Order', 'order_return' => 'Stripe\\OrderReturn', 'plan' => 'Stripe\\Plan', 'product' => 'Stripe\\Product', 'recipient' => 'Stripe\\Recipient', 'refund' => 'Stripe\\Refund', 'sku' => 'Stripe\\SKU', 'source' => 'Stripe\\Source', 'subscription' => 'Stripe\\Subscription', 'subscription_item' => 'Stripe\\SubscriptionItem', 'three_d_secure' => 'Stripe\\ThreeDSecure', '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\\StripeObject';
}
return $class::constructFrom($resp, $opts);
} else {
return $resp;
}
}