BraintreeInstance

Braintree Class Instance template.

Defined (1)

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

/classes/lib/Braintree/Braintree/Instance.php  
  1. abstract class Instance 
  2. protected $_attributes = []; 
  3.  
  4. /** 
  5. * @param array $attributes 
  6. */ 
  7. public function __construct($attributes) 
  8. if (!empty($attributes)) { 
  9. $this->_initializeFromArray($attributes); 
  10.  
  11. /** 
  12. * returns private/nonexistent instance properties 
  13. * @access public 
  14. * @param string $name property name 
  15. * @return mixed contents of instance properties 
  16. */ 
  17. public function __get($name) 
  18. if (array_key_exists($name, $this->_attributes)) { 
  19. return $this->_attributes[$name]; 
  20. } else { 
  21. trigger_error('Undefined property on ' . get_class($this) . ': ' . $name, E_USER_NOTICE); 
  22. return null; 
  23.  
  24. /** 
  25. * used by isset() and empty() 
  26. * @access public 
  27. * @param string $name property name 
  28. * @return boolean 
  29. */ 
  30. public function __isset($name) 
  31. return array_key_exists($name, $this->_attributes); 
  32.  
  33. /** 
  34. * create a printable representation of the object as: 
  35. * ClassName[property=value, property=value] 
  36. * @return string 
  37. */ 
  38. public function __toString() 
  39. $objOutput = Util::implodeAssociativeArray($this->_attributes); 
  40. return get_class($this) .'[' . $objOutput . ']'; 
  41. /** 
  42. * initializes instance properties from the keys/values of an array 
  43. * @ignore 
  44. * @access protected 
  45. * @param <type> $aAttribs array of properties to set - single level 
  46. * @return void 
  47. */ 
  48. private function _initializeFromArray($attributes) 
  49. $this->_attributes = $attributes; 
  50.