public static function convertToStripeObject($resp, $apiKey) { $types = array('charge' => 'Stripe\\Charge', 'customer' => 'Stripe\\Customer', 'invoice' => 'Stripe\\Invoice', 'invoiceitem' => 'Stripe\\InvoiceItem', 'event' => 'Stripe\\Event'); if (self::isList($resp)) { $mapped = array(); foreach ($resp as $i) { array_push($mapped, self::convertToStripeObject($i, $apiKey)); } return $mapped; } if (is_array($resp)) { if (isset($resp['object']) && is_string($resp['object']) && isset($types[$resp['object']])) { $class = $types[$resp['object']]; } else { $class = 'Stripe\\Object'; } return Object::scopedConstructFrom($class, $resp, $apiKey); } return $resp; }
if (self::$_permanentAttributes->includes($k)) { continue; } $this->_values[$k] = Util::convertToStripeObject($v, $apiKey); $this->_transientValues->discard($k); $this->_unsavedValues->discard($k); } } public function __toJSON() { if (defined('JSON_PRETTY_PRINT')) { return json_encode($this->__toArray(true), JSON_PRETTY_PRINT); } else { return json_encode($this->__toArray(true)); } } public function __toString() { return $this->__toJSON(); } public function __toArray($recursive = false) { if ($recursive) { return Util::convertStripeObjectToArray($this->_values); } else { return $this->_values; } } } Object::init();