class Braintree_Result_Successful in Commerce Braintree 7
Braintree Successful Result
A Successful Result will be returned from gateway methods when validations pass. It will provide access to the created resource.
For example, when creating a customer, Braintree_Result_Successful will respond to <b>customer</b> like so:
<code> $result = Braintree_Customer::create(array('first_name' => "John")); if ($result->success) { // Braintree_Result_Successful echo "Created customer {$result->customer->id}"; } else { // Braintree_Result_Error } </code>
@package Braintree @subpackage Result @copyright 2010 Braintree Payment Solutions
Hierarchy
- class \Braintree_Instance
- class \Braintree_Result_Successful
Expanded class hierarchy of Braintree_Result_Successful
File
- braintree_php/
lib/ Braintree/ Result/ Successful.php, line 34
View source
class Braintree_Result_Successful extends Braintree_Instance {
/**
*
* @var boolean always true
*/
public $success = true;
/**
*
* @var string stores the internal name of the object providing access to
*/
private $_returnObjectName;
/**
* @ignore
* @param string $classToReturn name of class to instantiate
*/
public function __construct($objToReturn = null) {
if (!empty($objToReturn)) {
// get a lowercase direct name for the property
$property = Braintree_Util::cleanClassName(get_class($objToReturn));
// save the name for indirect access
$this->_returnObjectName = $property;
// create the property!
$this->{$property} = $objToReturn;
}
}
/**
*
* @ignore
* @return string string representation of the object's structure
*/
public function __toString() {
$returnObject = $this->_returnObjectName;
return __CLASS__ . '[' . $this->{$returnObject}
->__toString() . ']';
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Braintree_Instance:: |
private | function | initializes instance properties from the keys/values of an array @ignore @access protected | |
Braintree_Instance:: |
public | function | returns private/nonexistent instance properties @access public | |
Braintree_Result_Successful:: |
public | property | ||
Braintree_Result_Successful:: |
private | property | ||
Braintree_Result_Successful:: |
public | function |
@ignore Overrides Braintree_Instance:: |
|
Braintree_Result_Successful:: |
public | function |
@ignore Overrides Braintree_Instance:: |