1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
Subtype.php
См. документацию.
1<?php
2
3namespace Bitrix\Im\V2\Link\File;
4
5use Bitrix\Disk\TypeFile;
6use JsonSerializable;
7
8enum Subtype: string implements JsonSerializable
9{
10 case Media = 'MEDIA';
11 case Audio = 'AUDIO';
12 case Brief = 'BRIEF';
13 case Document = 'DOCUMENT';
14 case Other = 'OTHER';
15
16 public static function tryFromDiskFileType(int $diskFileType): self
17 {
18 return match ($diskFileType)
19 {
20 TypeFile::IMAGE, TypeFile::VIDEO => self::Media,
21 TypeFile::DOCUMENT, TypeFile::PDF => self::Document,
22 TypeFile::AUDIO => self::Audio,
23 default => self::Other,
24 };
25 }
26
31 public static function getSubtypeFilter(string|array $subtypes): array
32 {
33 $result = [];
34
35 if (is_string($subtypes))
36 {
37 $subtypes = [$subtypes];
38 }
39
40 foreach ($subtypes as $subtype)
41 {
42 if (self::tryFrom($subtype) !== null)
43 {
44 $result[$subtype] = $subtype;
45 }
46 }
47
48 return array_values($result);
49 }
50
51 public static function tryFromOrDefault(string $value): self
52 {
53 return self::tryFrom($value) ?? self::Other;
54 }
55
56 public function jsonSerialize(): string
57 {
58 return mb_strtolower($this->value);
59 }
60}
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