class Braintree_Plan in Commerce Braintree 7
Hierarchy
- class \Braintree
- class \Braintree_Plan
 
 
Expanded class hierarchy of Braintree_Plan
File
- braintree_php/
lib/ Braintree/ Plan.php, line 2  
View source
class Braintree_Plan extends Braintree {
  public static function all() {
    $response = Braintree_Http::get('/plans');
    if (key_exists('plans', $response)) {
      $plans = array(
        "plan" => $response['plans'],
      );
    }
    else {
      $plans = array(
        "plan" => array(),
      );
    }
    return Braintree_Util::extractAttributeAsArray($plans, 'plan');
  }
  public static function factory($attributes) {
    $instance = new self();
    $instance
      ->_initialize($attributes);
    return $instance;
  }
  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;
  }
}Members
| 
            Name | 
                  Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| 
            Braintree:: | 
                  public static | function | ||
| 
            Braintree:: | 
                  public | function | ||
| 
            Braintree:: | 
                  protected | function | @ignore don't permit cloning the instances (like $x = clone $v) | |
| 
            Braintree:: | 
                  protected | function | @ignore don't permit an explicit call of the constructor! (like $t = new Braintree_Transaction()) | 1 | 
| 
            Braintree:: | 
                  public | function | returns private/nonexistent instance properties @ignore @access public | |
| 
            Braintree:: | 
                  public | function | used by isset() and empty() @access public | |
| 
            Braintree_Plan:: | 
                  public static | function | ||
| 
            Braintree_Plan:: | 
                  public static | function | ||
| 
            Braintree_Plan:: | 
                  protected | function |