protected function Braintree_Subscription::_initialize in Commerce Braintree 7
@ignore
File
- braintree_php/
lib/ Braintree/ Subscription.php, line 175
Class
- Braintree_Subscription
- Braintree Subscription module
Code
protected function _initialize($attributes) {
$this->_attributes = $attributes;
$addOnArray = array();
if (isset($attributes['addOns'])) {
foreach ($attributes['addOns'] as $addOn) {
$addOnArray[] = Braintree_AddOn::factory($addOn);
}
}
$this->_attributes['addOns'] = $addOnArray;
$discountArray = array();
if (isset($attributes['discounts'])) {
foreach ($attributes['discounts'] as $discount) {
$discountArray[] = Braintree_Discount::factory($discount);
}
}
$this->_attributes['discounts'] = $discountArray;
if (isset($attributes['descriptor'])) {
$this
->_set('descriptor', new Braintree_Descriptor($attributes['descriptor']));
}
$transactionArray = array();
if (isset($attributes['transactions'])) {
foreach ($attributes['transactions'] as $transaction) {
$transactionArray[] = Braintree_Transaction::factory($transaction);
}
}
$this->_attributes['transactions'] = $transactionArray;
}