當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Braintree_Customer::factory方法代碼示例

本文整理匯總了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;
 }
開發者ID:robelkin,項目名稱:braintree_php,代碼行數:6,代碼來源:CustomerTest.php

示例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");
         }
     }
 }
開發者ID:beevo,項目名稱:disruptivestrong,代碼行數:26,代碼來源:CustomerGateway.php


注:本文中的Braintree_Customer::factory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。