protected function Braintree_CreditCard::_initialize in Commerce Braintree 7
sets instance properties from an array of values
@access protected
Parameters
array $creditCardAttribs array of creditcard data:
Return value
none
File
- braintree_php/
lib/ Braintree/ CreditCard.php, line 384
Class
- Braintree_CreditCard
- Creates and manages Braintree CreditCards
Code
protected function _initialize($creditCardAttribs) {
// set the attributes
$this->_attributes = $creditCardAttribs;
// map each address into its own object
$billingAddress = isset($creditCardAttribs['billingAddress']) ? Braintree_Address::factory($creditCardAttribs['billingAddress']) : null;
$subscriptionArray = array();
if (isset($creditCardAttribs['subscriptions'])) {
foreach ($creditCardAttribs['subscriptions'] as $subscription) {
$subscriptionArray[] = Braintree_Subscription::factory($subscription);
}
}
$this
->_set('subscriptions', $subscriptionArray);
$this
->_set('billingAddress', $billingAddress);
$this
->_set('expirationDate', $this->expirationMonth . '/' . $this->expirationYear);
$this
->_set('maskedNumber', $this->bin . '******' . $this->last4);
}