BraintreeResultSuccessful

Braintree Successful Result.

Defined (1)

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

/includes/lib/Braintree/lib/Braintree/Result/Successful.php  
  1. class Successful extends Instance 
  2. /** 
  3. * @var boolean always true 
  4. */ 
  5. public $success = true; 
  6. /** 
  7. * @var string stores the internal name of the object providing access to 
  8. */ 
  9. private $_returnObjectNames; 
  10.  
  11. /** 
  12. * @ignore 
  13. * @param array|null $objsToReturn 
  14. * @param array|null $propertyNames 
  15. */ 
  16. public function __construct($objsToReturn = [], $propertyNames = []) 
  17. // Sanitize arguments (preserves backwards compatibility) 
  18. if (!is_array($objsToReturn)) { $objsToReturn = [$objsToReturn]; } 
  19. if (!is_array($propertyNames)) { $propertyNames = [$propertyNames]; } 
  20.  
  21. $objects = $this->_mapPropertyNamesToObjsToReturn($propertyNames, $objsToReturn); 
  22. $this->_attributes = []; 
  23. $this->_returnObjectNames = []; 
  24.  
  25. foreach ($objects as $propertyName => $objToReturn) { 
  26.  
  27. // save the name for indirect access 
  28. array_push($this->_returnObjectNames, $propertyName); 
  29.  
  30. // create the property! 
  31. $this->$propertyName = $objToReturn; 
  32.  
  33. /** 
  34. * @ignore 
  35. * @return string string representation of the object's structure 
  36. */ 
  37. public function __toString() 
  38. $objects = []; 
  39. foreach ($this->_returnObjectNames as $returnObjectName) { 
  40. array_push($objects, $this->$returnObjectName); 
  41. return __CLASS__ . '[' . implode(', ', $objects) . ']'; 
  42.  
  43. private function _mapPropertyNamesToObjsToReturn($propertyNames, $objsToReturn) { 
  44. if(count($objsToReturn) != count($propertyNames)) { 
  45. $propertyNames = []; 
  46. foreach ($objsToReturn as $obj) { 
  47. array_push($propertyNames, Util::cleanClassName(get_class($obj))); 
  48. return array_combine($propertyNames, $objsToReturn);