public static function Braintree::returnObjectOrThrowException in Commerce Braintree 7
Parameters
string $className:
object $resultObj:
Return value
object returns the passed object if successful
Throws
Braintree_Exception_ValidationsFailed
17 calls to Braintree::returnObjectOrThrowException()
- Braintree_Address::createNoValidate in braintree_php/
lib/ Braintree/ Address.php - attempts the create operation assuming all data will validate returns a Braintree_Address object instead of a Result
- Braintree_Address::updateNoValidate in braintree_php/
lib/ Braintree/ Address.php - update an address record, assuming validations will pass
- Braintree_BraintreeTest::testReturnException in braintree_php/
tests/ unit/ BraintreeTest.php - @expectedException Braintree_Exception_ValidationsFailed
- Braintree_BraintreeTest::testReturnObject in braintree_php/
tests/ unit/ BraintreeTest.php - Braintree_CreditCard::createNoValidate in braintree_php/
lib/ Braintree/ CreditCard.php - attempts the create operation assuming all data will validate returns a Braintree_CreditCard object instead of a Result
File
- braintree_php/
lib/ Braintree.php, line 79
Class
- Braintree
- Braintree PHP Library
Code
public static function returnObjectOrThrowException($className, $resultObj) {
$resultObjName = Braintree_Util::cleanClassName($className);
if ($resultObj->success) {
return $resultObj->{$resultObjName};
}
else {
throw new Braintree_Exception_ValidationsFailed();
}
}