本文整理汇总了PHP中Braintree_Util::throwStatusCodeException方法的典型用法代码示例。如果您正苦于以下问题:PHP Braintree_Util::throwStatusCodeException方法的具体用法?PHP Braintree_Util::throwStatusCodeException怎么用?PHP Braintree_Util::throwStatusCodeException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Braintree_Util
的用法示例。
在下文中一共展示了Braintree_Util::throwStatusCodeException方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: put
public static function put($path, $params = null)
{
$response = self::_doRequest('PUT', $path, self::_buildXml($params));
$responseCode = $response['status'];
if ($responseCode === 200 || $responseCode === 201 || $responseCode === 422) {
return Braintree_Xml::buildArrayFromXml($response['body']);
} else {
Braintree_Util::throwStatusCodeException($responseCode);
}
}
示例2: put
public function put($path, $params = null)
{
$body = http_build_query(Braintree_Util::camelCaseToDelimiterArray($params, '_'));
$response = $this->_doRequest('PUT', $path, $body);
$responseCode = $response['status'];
if ($responseCode === 200 || $responseCode === 201 || $responseCode === 422 || $responseCode === 400) {
return Braintree_Util::delimiterToCamelCaseArray(json_decode($response['body'], true), '_');
} else {
Braintree_Util::throwStatusCodeException($responseCode);
}
}
示例3: testThrowUnknownException
/**
* @expectedException Braintree_Exception_Unexpected
*/
function testThrowUnknownException()
{
Braintree_Util::throwStatusCodeException(999);
}
示例4: parseAndValidateQueryString
public function parseAndValidateQueryString($queryString)
{
// parse the params into an array
parse_str($queryString, $params);
// remove the hash
$queryStringWithoutHash = null;
if (preg_match('/^(.*)&hash=[a-f0-9]+$/', $queryString, $match)) {
$queryStringWithoutHash = $match[1];
}
if ($params['http_status'] != '200') {
$message = null;
if (array_key_exists('bt_message', $params)) {
$message = $params['bt_message'];
}
Braintree_Util::throwStatusCodeException($params['http_status'], $message);
}
// recreate the hash and compare it
if ($this->_hash($queryStringWithoutHash) == $params['hash']) {
return $params;
} else {
throw new Braintree_Exception_ForgedQueryString();
}
}