Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
ErrorInformant.php
1
<?php
2
3
namespace
Bitrix\MessageService\Providers\Twilio
;
4
5
use
Bitrix\Main\Error
;
6
use
Bitrix\Main\Localization\Loc
;
7
8
class
ErrorInformant
9
{
10
protected
?
int
$code
;
11
protected
int
$httpStatus
;
12
protected
?
string
$message
;
13
protected
?
string
$moreInfo
;
14
20
public
function
__construct
(?
string
$message
, ?
int
$code
, ?
string
$moreInfo
,
int
$httpStatus
)
21
{
22
$this->code =
$code
;
23
$this->message =
$message
;
24
$this->moreInfo =
$moreInfo
;
25
$this->httpStatus =
$httpStatus
;
26
}
27
28
public
function
getError
():
Error
29
{
30
return
new
Error
($this->
getErrorMessage
(), $this->code ?? 0);
31
}
32
33
protected
function
getErrorMessage
(): string
34
{
35
36
$str =
Loc::getMessage
(
'MESSAGESERVICE_PROVIDER_TWILIO_ERROR_INFORMANT_ERROR'
, [
37
'#BR#'
=>
'<br>'
,
38
]);
39
40
if
(isset($this->moreInfo))
41
{
42
$str .=
Loc::getMessage
(
'MESSAGESERVICE_PROVIDER_TWILIO_ERROR_INFORMANT_ERROR_MORE'
, [
43
'#LINKSTART#'
=>
'<a href="'
. $this->moreInfo .
'" target="_blank">'
,
44
'#INFO#'
=> $this->moreInfo,
45
'#LINKEND#'
=>
'</a>'
,
46
]);
47
48
return
$str;
49
}
50
51
if
(isset($this->message, $this->code))
52
{
53
$str .=
Loc::getMessage
(
'MESSAGESERVICE_PROVIDER_TWILIO_ERROR_INFORMANT_ERROR_CODE'
, [
54
'#CODE#'
=> $this->code,
55
'#MESSAGE#'
=> $this->message,
56
]);
57
58
return
$str;
59
}
60
61
$str .=
Loc::getMessage
(
'MESSAGESERVICE_PROVIDER_TWILIO_ERROR_INFORMANT_ERROR_HTTP_STATUS'
, [
62
'#STATUS#'
=> $this->httpStatus,
63
]);
64
65
return
$str;
66
}
67
}
Bitrix\Main\Error
Definition
error.php:14
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\MessageService\Providers\Twilio\ErrorInformant
Definition
ErrorInformant.php:9
Bitrix\MessageService\Providers\Twilio\ErrorInformant\getError
getError()
Definition
ErrorInformant.php:28
Bitrix\MessageService\Providers\Twilio\ErrorInformant\$message
string $message
Definition
ErrorInformant.php:12
Bitrix\MessageService\Providers\Twilio\ErrorInformant\getErrorMessage
getErrorMessage()
Definition
ErrorInformant.php:33
Bitrix\MessageService\Providers\Twilio\ErrorInformant\__construct
__construct(?string $message, ?int $code, ?string $moreInfo, int $httpStatus)
Definition
ErrorInformant.php:20
Bitrix\MessageService\Providers\Twilio\ErrorInformant\$moreInfo
string $moreInfo
Definition
ErrorInformant.php:13
Bitrix\MessageService\Providers\Twilio\ErrorInformant\$httpStatus
int $httpStatus
Definition
ErrorInformant.php:11
Bitrix\MessageService\Providers\Twilio\ErrorInformant\$code
int $code
Definition
ErrorInformant.php:10
Bitrix\MessageService\Providers\Twilio
Definition
ErrorInformant.php:3
modules
messageservice
lib
Providers
Twilio
ErrorInformant.php
Создано системой
1.10.0