Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
message.php
1
<?php
2
3
namespace
Bitrix\Sale\Delivery\Requests\Message
;
4
5
use
Bitrix\Main\Type\DateTime
;
6
13
final
class
Message
14
{
15
public
const
TYPE_SHIPMENT_PICKUPED
=
'SHIPMENT_PICKUPED'
;
16
18
private
$subject;
19
21
private
$body;
22
24
private
$status;
25
27
private
$type;
28
30
private
$currency;
31
33
private
$moneyValues = [];
34
36
private
$dateValues = [];
37
41
public
function
getSubject
(): ?string
42
{
43
return
$this->subject;
44
}
45
49
public
function
getBody
(): ?string
50
{
51
return
$this->body;
52
}
53
57
public
function
getBodyForHtml
(): string
58
{
59
$result = htmlspecialcharsbx($this->
getBody
());
60
61
$moneyValues = $this->
getMoneyValues
();
62
$currency = $this->
getCurrency
();
63
if
($moneyValues && $currency)
64
{
65
$result = str_replace(
66
array_keys($moneyValues),
67
array_map(
68
static
function
($moneyValue) use ($currency)
69
{
70
return
SaleFormatCurrency($moneyValue, $currency);
71
},
72
$this->
getMoneyValues
()
73
),
74
$result
75
);
76
}
77
78
$dateValues = $this->
getDateValues
();
79
if
($dateValues)
80
{
81
$result = str_replace(
82
array_keys($dateValues),
83
array_map(
84
static
function
($dateValue)
85
{
86
if
(!isset($dateValue[
'VALUE'
]) || !isset($dateValue[
'FORMAT'
]))
87
{
88
return
''
;
89
}
90
91
return
92
DateTime::createFromTimestamp
((
int
)$dateValue[
'VALUE'
])
93
->toUserTime()
94
->format($dateValue[
'FORMAT'
])
95
;
96
},
97
$dateValues
98
),
99
$result
100
);
101
}
102
103
return
$result;
104
}
105
109
public
function
getStatus
(): ?
Status
110
{
111
return
$this->status;
112
}
113
117
public
function
getType
(): ?string
118
{
119
return
$this->type;
120
}
121
125
public
function
getCurrency
(): ?string
126
{
127
return
$this->currency;
128
}
129
133
public
function
getMoneyValues
(): array
134
{
135
return
$this->moneyValues;
136
}
137
141
public
function
getDateValues
(): array
142
{
143
return
$this->dateValues;
144
}
145
150
public
function
setSubject
(
string
$subject):
Message
151
{
152
$this->subject = $subject;
153
154
return
$this;
155
}
156
161
public
function
setBody
(
string
$body):
Message
162
{
163
$this->body = $body;
164
165
return
$this;
166
}
167
172
public
function
setStatus
(
Status
$status):
Message
173
{
174
$this->status = $status;
175
176
return
$this;
177
}
178
183
public
function
setType
(
string
$type):
Message
184
{
185
$this->type = $type;
186
187
return
$this;
188
}
189
195
public
function
addMoneyValue
(
string
$key,
float
$value):
Message
196
{
197
$this->moneyValues[$key] = $value;
198
199
return
$this;
200
}
201
206
public
function
setCurrency
(
string
$currency):
Message
207
{
208
$this->currency = $currency;
209
210
return
$this;
211
}
212
219
public
function
addDateValue
(
string
$key,
int
$value,
string
$format):
Message
220
{
221
$this->dateValues[$key] = [
222
'VALUE'
=> $value,
223
'FORMAT'
=> $format,
224
];
225
226
return
$this;
227
}
228
}
Bitrix\Main\Type\DateTime
Definition
datetime.php:9
Bitrix\Main\Type\DateTime\createFromTimestamp
static createFromTimestamp($timestamp)
Definition
datetime.php:246
Bitrix\Sale\Delivery\Requests\Message\Message
Definition
message.php:14
Bitrix\Sale\Delivery\Requests\Message\Message\setCurrency
setCurrency(string $currency)
Definition
message.php:206
Bitrix\Sale\Delivery\Requests\Message\Message\getBodyForHtml
getBodyForHtml()
Definition
message.php:57
Bitrix\Sale\Delivery\Requests\Message\Message\getDateValues
getDateValues()
Definition
message.php:141
Bitrix\Sale\Delivery\Requests\Message\Message\TYPE_SHIPMENT_PICKUPED
const TYPE_SHIPMENT_PICKUPED
Definition
message.php:15
Bitrix\Sale\Delivery\Requests\Message\Message\setSubject
setSubject(string $subject)
Definition
message.php:150
Bitrix\Sale\Delivery\Requests\Message\Message\getCurrency
getCurrency()
Definition
message.php:125
Bitrix\Sale\Delivery\Requests\Message\Message\addMoneyValue
addMoneyValue(string $key, float $value)
Definition
message.php:195
Bitrix\Sale\Delivery\Requests\Message\Message\getMoneyValues
getMoneyValues()
Definition
message.php:133
Bitrix\Sale\Delivery\Requests\Message\Message\getSubject
getSubject()
Definition
message.php:41
Bitrix\Sale\Delivery\Requests\Message\Message\getType
getType()
Definition
message.php:117
Bitrix\Sale\Delivery\Requests\Message\Message\setBody
setBody(string $body)
Definition
message.php:161
Bitrix\Sale\Delivery\Requests\Message\Message\getStatus
getStatus()
Definition
message.php:109
Bitrix\Sale\Delivery\Requests\Message\Message\addDateValue
addDateValue(string $key, int $value, string $format)
Definition
message.php:219
Bitrix\Sale\Delivery\Requests\Message\Message\getBody
getBody()
Definition
message.php:49
Bitrix\Sale\Delivery\Requests\Message\Message\setStatus
setStatus(Status $status)
Definition
message.php:172
Bitrix\Sale\Delivery\Requests\Message\Message\setType
setType(string $type)
Definition
message.php:183
Bitrix\Sale\Delivery\Requests\Message\Status
Definition
status.php:13
Bitrix\Sale\Delivery\Requests\Message
Definition
message.php:3
modules
sale
lib
delivery
requests
message
message.php
Создано системой
1.10.0