Merchant.php 952 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace Braintree;
  3. class Merchant extends Base
  4. {
  5. protected function _initialize($attribs)
  6. {
  7. $this->_attributes = $attribs;
  8. $merchantAccountArray = [];
  9. if (isset($attribs['merchantAccounts'])) {
  10. foreach ($attribs['merchantAccounts'] AS $merchantAccount) {
  11. $merchantAccountArray[] = MerchantAccount::factory($merchantAccount);
  12. }
  13. }
  14. $this->_set('merchantAccounts', $merchantAccountArray);
  15. }
  16. public static function factory($attributes)
  17. {
  18. $instance = new self();
  19. $instance->_initialize($attributes);
  20. return $instance;
  21. }
  22. /**
  23. * returns a string representation of the merchant
  24. * @return string
  25. */
  26. public function __toString()
  27. {
  28. return __CLASS__ . '[' .
  29. Util::attributesToString($this->_attributes) .']';
  30. }
  31. }
  32. class_alias('Braintree\Merchant', 'Braintree_Merchant');