本文整理汇总了PHP中LANG::translate方法的典型用法代码示例。如果您正苦于以下问题:PHP LANG::translate方法的具体用法?PHP LANG::translate怎么用?PHP LANG::translate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LANG
的用法示例。
在下文中一共展示了LANG::translate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: errorHandler
public static function errorHandler($resp, $code)
{
$resp = json_decode($resp, true);
$message = isset($resp['message']) ? $resp['message'] : null;
$message_to_purchaser = isset($resp['message_to_purchaser']) ? $resp['message_to_purchaser'] : null;
$type = isset($resp['type']) ? $resp['type'] : null;
$params = isset($resp['param']) ? $resp['param'] : null;
if (isset($code) != true || $code == 0) {
throw new Conekta_NoConnectionError(LANG::translate('error.requestor.connection', array('BASE' => Conekta::$apiBase), LANG::EN), LANG::translate('error.requestor.connection_purchaser', null, Conekta::$locale), $type, $code, $params);
}
switch ($code) {
case 400:
throw new Conekta_MalformedRequestError($message, $message_to_purchaser, $type, $code, $params);
case 401:
throw new Conekta_AuthenticationError($message, $message_to_purchaser, $type, $code, $params);
case 402:
throw new Conekta_ProcessingError($message, $message_to_purchaser, $type, $code, $params);
case 404:
throw new Conekta_ResourceNotFoundError($message, $message_to_purchaser, $type, $code, $params);
case 422:
throw new Conekta_ParameterValidationError($message, $message_to_purchaser, $type, $code, $params);
case 500:
throw new Conekta_ApiError($message, $message_to_purchaser, $type, $code, $params);
default:
throw new self($message, $message_to_purchaser, $type, $code, $params);
}
}
示例2: instanceUrl
public function instanceUrl()
{
$id = $this->id;
if (!$id) {
throw new Conekta_Error(LANG::translate('error.resource.id', array('RESOURCE' => get_class()), LANG::EN), LANG::translate('error.resource.id_purchaser', null, Conekta::$locale));
}
$class = get_class($this);
$base = $this->classUrl($class);
$extn = urlencode($id);
return "{$base}/{$extn}";
}
示例3: instanceUrl
public function instanceUrl()
{
$id = $this->id;
if (!$id) {
throw new Conekta_Error(LANG::translate('error.resource.id', array('RESOURCE' => get_class()), LANG::EN), LANG::translate('error.resource.id_purchaser', null, Conekta::$locale));
}
$class = get_class($this);
$base = '/subscription';
$customerUrl = $this->customer->instanceUrl();
return "{$customerUrl}{$base}";
}