本文整理匯總了PHP中Braintree_Customer::factory方法的典型用法代碼示例。如果您正苦於以下問題:PHP Braintree_Customer::factory方法的具體用法?PHP Braintree_Customer::factory怎麽用?PHP Braintree_Customer::factory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Braintree_Customer
的用法示例。
在下文中一共展示了Braintree_Customer::factory方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testGet_givesErrorIfInvalidProperty
function testGet_givesErrorIfInvalidProperty()
{
$this->setExpectedException('PHPUnit_Framework_Error', 'Undefined property on Braintree_Customer: foo');
$c = Braintree_Customer::factory(array());
$c->foo;
}
示例2: _verifyGatewayResponse
/**
* generic method for validating incoming gateway responses
*
* creates a new Braintree_Customer object and encapsulates
* it inside a Braintree_Result_Successful object, or
* encapsulates a Braintree_Errors object inside a Result_Error
* alternatively, throws an Unexpected exception if the response is invalid.
*
* @ignore
* @param array $response gateway response values
* @return object Result_Successful or Result_Error
* @throws Braintree_Exception_Unexpected
*/
private function _verifyGatewayResponse($response)
{
if (isset($response['customer'])) {
// return a populated instance of Braintree_Customer
return new Braintree_Result_Successful(Braintree_Customer::factory($response['customer']));
} else {
if (isset($response['apiErrorResponse'])) {
return new Braintree_Result_Error($response['apiErrorResponse']);
} else {
throw new Braintree_Exception_Unexpected("Expected customer or apiErrorResponse");
}
}
}