BraintreeAddress

Braintree Address module PHP Version 5 Creates and manages Braintree Addresses.

Defined (1)

The class is defined in the following location(s).

/includes/lib/Braintree/lib/Braintree/Address.php  
  1. class Address extends Base 
  2. /** 
  3. * returns false if comparing object is not a Address,  
  4. * or is a Address with a different id 
  5. * @param object $other address to compare against 
  6. * @return boolean 
  7. */ 
  8. public function isEqual($other) 
  9. return !($other instanceof self) ? 
  10. false : 
  11. ($this->id === $other->id && $this->customerId === $other->customerId); 
  12.  
  13. /** 
  14. * create a printable representation of the object as: 
  15. * ClassName[property=value, property=value] 
  16. * @ignore 
  17. * @return string 
  18. */ 
  19. public function __toString() 
  20. return __CLASS__ . '[' . 
  21. Util::attributesToString($this->_attributes) . ']'; 
  22.  
  23. /** 
  24. * sets instance properties from an array of values 
  25. * @ignore 
  26. * @access protected 
  27. * @param array $addressAttribs array of address data 
  28. * @return void 
  29. */ 
  30. protected function _initialize($addressAttribs) 
  31. // set the attributes 
  32. $this->_attributes = $addressAttribs; 
  33.  
  34. /** 
  35. * factory method: returns an instance of Address 
  36. * to the requesting method, with populated properties 
  37. * @ignore 
  38. * @return Address 
  39. */ 
  40. public static function factory($attributes) 
  41. $instance = new self(); 
  42. $instance->_initialize($attributes); 
  43. return $instance; 
  44.  
  45.  
  46.  
  47. // static methods redirecting to gateway 
  48.  
  49. /** 
  50. * @param array $attribs 
  51. * @return Address 
  52. */ 
  53. public static function create($attribs) 
  54. return Configuration::gateway()->address()->create($attribs); 
  55.  
  56. /** 
  57. * @param array $attribs 
  58. * @return Address 
  59. */ 
  60. public static function createNoValidate($attribs) 
  61. return Configuration::gateway()->address()->createNoValidate($attribs); 
  62.  
  63. /** 
  64. * @param Customer|int $customerOrId 
  65. * @param int $addressId 
  66. * @throws InvalidArgumentException 
  67. * @return Result\Successful 
  68. */ 
  69. public static function delete($customerOrId = null, $addressId = null) 
  70. return Configuration::gateway()->address()->delete($customerOrId, $addressId); 
  71.  
  72. /** 
  73. * @param Customer|int $customerOrId 
  74. * @param int $addressId 
  75. * @throws Exception\NotFound 
  76. * @return Address 
  77. */ 
  78. public static function find($customerOrId, $addressId) 
  79. return Configuration::gateway()->address()->find($customerOrId, $addressId); 
  80.  
  81. /** 
  82. * @param Customer|int $customerOrId 
  83. * @param int $addressId 
  84. * @param array $attributes 
  85. * @throws Exception\Unexpected 
  86. * @return Result\Successful|Result\Error 
  87. */ 
  88. public static function update($customerOrId, $addressId, $attributes) 
  89. return Configuration::gateway()->address()->update($customerOrId, $addressId, $attributes); 
  90.  
  91. public static function updateNoValidate($customerOrId, $addressId, $attributes) 
  92. return Configuration::gateway()->address()->updateNoValidate($customerOrId, $addressId, $attributes);