You are here

protected function Braintree_Plan::_initialize in Commerce Braintree 7

File

braintree_php/lib/Braintree/Plan.php, line 27

Class

Braintree_Plan

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;
  $planArray = array();
  if (isset($attributes['plans'])) {
    foreach ($attributes['plans'] as $plan) {
      $planArray[] = Braintree_Plan::factory($plan);
    }
  }
  $this->_attributes['plans'] = $planArray;
}