1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
SubtypeGroup.php
См. документацию.
1<?php
2
3namespace Bitrix\Im\V2\Link\File;
4
5use JsonSerializable;
6
7enum SubtypeGroup: string implements JsonSerializable
8{
9 case Media = 'MEDIA';
10 case Audio = 'AUDIO';
11 case File = 'FILE';
12 case Brief = 'BRIEF';
13
14 public static function tryFromSubtype(Subtype $subtype): self
15 {
16 return match ($subtype)
17 {
18 Subtype::Media => self::Media,
19 Subtype::Audio => self::Audio,
20 Subtype::Brief => self::Brief,
21 Subtype::Document, Subtype::Other => self::File,
22 };
23 }
24
29 public static function tryFromArray(array $groups): array
30 {
31 $result = [];
32
33 foreach ($groups as $group)
34 {
35 $group = self::tryFrom($group);
36 if (isset($group))
37 {
38 $result[$group->value] = $group;
39 }
40 }
41
42 return array_values($result);
43 }
44
48 public function getSubtypes(): array
49 {
50 return match ($this)
51 {
52 self::Media => [Subtype::Media],
53 self::Audio => [Subtype::Audio],
54 self::Brief => [Subtype::Brief],
55 self::File => [Subtype::Document, Subtype::Other],
56 };
57 }
58
63 public static function getSubtypeFilter(string|array $subtypeGroups): array
64 {
65 $result = [];
66 if (is_string($subtypeGroups))
67 {
68 $subtypeGroups = [$subtypeGroups];
69 }
70
71 $subtypeGroups = self::tryFromArray($subtypeGroups);
72
73 foreach ($subtypeGroups as $subtypeGroup)
74 {
75 foreach ($subtypeGroup->getSubtypes() as $subtype)
76 {
77 $result[$subtype->value] = $subtype->value;
78 }
79 }
80
81 return array_values($result);
82 }
83
84 public function jsonSerialize(): string
85 {
86 return mb_strtolower($this->value);
87 }
88}
jsonSerialize()
Определения error.php:94
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
$groups
Определения options.php:30
Определения Image.php:9