Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
FilePopupItem.php
1
<?php
2
3
namespace
Bitrix\Im\V2\Entity\File
;
4
5
use
Bitrix\Im\V2\Rest\PopupData
;
6
use
Bitrix\Im\V2\Rest\PopupDataAggregatable
;
7
use
Bitrix\Im\V2\Rest\PopupDataItem
;
8
9
class
FilePopupItem
implements
PopupDataItem
,
PopupDataAggregatable
10
{
11
private
FileCollection
$files;
12
13
public
function
__construct
($files =
null
)
14
{
15
if
(!$files instanceof
FileCollection
)
16
{
17
$this->files =
new
FileCollection
();
18
}
19
else
20
{
21
$this->files = $files;
22
}
23
24
if
($files instanceof
FileItem
)
25
{
26
if
($this->files->getById($files->getId()) ===
null
)
27
{
28
$this->files[] = $files;
29
}
30
}
31
}
32
33
public
function
merge
(
PopupDataItem
$item): self
34
{
35
if
($item instanceof
self
)
36
{
37
foreach
($item->files as $file)
38
{
39
if
($this->files->getById($file->getId()) ===
null
)
40
{
41
$this->files[] = $file;
42
}
43
}
44
}
45
46
return
$this;
47
}
48
49
public
static
function
getRestEntityName
(): string
50
{
51
return
FileCollection::getRestEntityName
();
52
}
53
54
public
function
toRestFormat
(array $option = []): array
55
{
56
return
$this->files->getUnique()->toRestFormat($option);
57
}
58
59
public
function
getPopupData
(array $excludedList = []):
PopupData
60
{
61
return
$this->files->getPopupData($excludedList);
62
}
63
}
Bitrix\Im\V2\Entity\File\FileCollection
Definition
FileCollection.php:23
Bitrix\Im\V2\Entity\File\FileCollection\getRestEntityName
static getRestEntityName()
Definition
FileCollection.php:41
Bitrix\Im\V2\Entity\File\FileItem
Definition
FileItem.php:23
Bitrix\Im\V2\Entity\File\FilePopupItem
Definition
FilePopupItem.php:10
Bitrix\Im\V2\Entity\File\FilePopupItem\getRestEntityName
static getRestEntityName()
Definition
FilePopupItem.php:49
Bitrix\Im\V2\Entity\File\FilePopupItem\toRestFormat
toRestFormat(array $option=[])
Definition
FilePopupItem.php:54
Bitrix\Im\V2\Entity\File\FilePopupItem\getPopupData
getPopupData(array $excludedList=[])
Definition
FilePopupItem.php:59
Bitrix\Im\V2\Entity\File\FilePopupItem\__construct
__construct($files=null)
Definition
FilePopupItem.php:13
Bitrix\Im\V2\Entity\File\FilePopupItem\merge
merge(PopupDataItem $item)
Definition
FilePopupItem.php:33
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\Entity\File
Definition
FileCollection.php:3
modules
im
lib
V2
Entity
File
FilePopupItem.php
Создано системой
1.10.0