Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
AdditionalMessagePopupItem.php
1
<?php
2
3
namespace
Bitrix\Im\V2\Message
;
4
5
use
Bitrix\Im\V2\MessageCollection
;
6
use
Bitrix\Im\V2\Rest\PopupData
;
7
use
Bitrix\Im\V2\Rest\PopupDataAggregatable
;
8
use
Bitrix\Im\V2\Rest\PopupDataItem
;
9
10
class
AdditionalMessagePopupItem
implements
PopupDataItem
,
PopupDataAggregatable
11
{
15
private
array $messageIds;
16
private
?
MessageCollection
$messages =
null
;
17
18
public
function
__construct
(array $messageIds)
19
{
20
$this->messageIds = array_unique($messageIds);
21
}
22
23
public
function
merge
(
PopupDataItem
$item):
PopupDataItem
24
{
25
if
($item instanceof
self
)
26
{
27
$this->messageIds = array_unique(array_merge($this->messageIds, $item->messageIds));
28
}
29
30
return
$this;
31
}
32
33
public
static
function
getRestEntityName
(): string
34
{
35
return
'additionalMessages'
;
36
}
37
38
public
function
toRestFormat
(array $option = []): array
39
{
40
return
$this->getMessages()->toRestFormat($option);
41
}
42
43
public
function
getPopupData
(array $excludedList = []):
PopupData
44
{
45
return
$this->getMessages()->getPopupData($excludedList);
46
}
47
48
private
function
getMessages():
MessageCollection
49
{
50
$this->messages ??=
new
MessageCollection
(array_unique($this->messageIds));
51
52
return
$this->messages;
53
}
54
}
Bitrix\Im\V2\Message\AdditionalMessagePopupItem
Definition
AdditionalMessagePopupItem.php:11
Bitrix\Im\V2\Message\AdditionalMessagePopupItem\__construct
__construct(array $messageIds)
Definition
AdditionalMessagePopupItem.php:18
Bitrix\Im\V2\Message\AdditionalMessagePopupItem\getRestEntityName
static getRestEntityName()
Definition
AdditionalMessagePopupItem.php:33
Bitrix\Im\V2\Message\AdditionalMessagePopupItem\toRestFormat
toRestFormat(array $option=[])
Definition
AdditionalMessagePopupItem.php:38
Bitrix\Im\V2\Message\AdditionalMessagePopupItem\getPopupData
getPopupData(array $excludedList=[])
Definition
AdditionalMessagePopupItem.php:43
Bitrix\Im\V2\Message\AdditionalMessagePopupItem\merge
merge(PopupDataItem $item)
Definition
AdditionalMessagePopupItem.php:23
Bitrix\Im\V2\MessageCollection
Definition
MessageCollection.php:35
Bitrix\Im\V2\Rest\PopupData
Definition
PopupData.php:6
Bitrix\Im\V2\Rest\PopupDataAggregatable
Definition
PopupDataAggregatable.php:10
Bitrix\Im\V2\Rest\PopupDataItem
Definition
PopupDataItem.php:6
Bitrix\Im\V2\Message
Definition
AdditionalMessagePopupItem.php:3
modules
im
lib
V2
Message
AdditionalMessagePopupItem.php
Создано системой
1.10.0