Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
AdditionalMessagePopupItem.php
1<?php
2
4
9
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}