protected function Braintree_Customer::_initialize in Commerce Braintree 7
sets instance properties from an array of values
@ignore @access protected
Parameters
array $customerAttribs array of customer data:
Return value
none
File
- braintree_php/
lib/ Braintree/ Customer.php, line 398
Class
- Braintree_Customer
- Creates and manages Customers
Code
protected function _initialize($customerAttribs) {
// set the attributes
$this->_attributes = $customerAttribs;
// map each address into its own object
$addressArray = array();
if (isset($customerAttribs['addresses'])) {
foreach ($customerAttribs['addresses'] as $address) {
$addressArray[] = Braintree_Address::factory($address);
}
}
$this
->_set('addresses', $addressArray);
// map each creditcard into its own object
$ccArray = array();
if (isset($customerAttribs['creditCards'])) {
foreach ($customerAttribs['creditCards'] as $creditCard) {
$ccArray[] = Braintree_CreditCard::factory($creditCard);
}
}
$this
->_set('creditCards', $ccArray);
}