1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
ExternalTypeRegistry.php
См. документацию.
1<?php
2
3namespace Bitrix\Im\V2\Chat\ExternalChat;
4
5use Bitrix\Im\V2\Chat\ExternalChat\Event\RegisterTypeEvent;
6use Bitrix\Main\EventResult;
7
9{
10 private static self $instance;
11
15 private array $registry = [];
16
17 private function __construct()
18 {
19 $this->load();
20 }
21
22 public static function getInstance(): ExternalTypeRegistry
23 {
24 self::$instance ??= new self();
25
26 return self::$instance;
27 }
28
29 public function getConfigs(): array
30 {
31 return $this->registry;
32 }
33
34 public function getConfigByType(string $type): ?Config
35 {
36 return $this->registry[$type] ?? null;
37 }
38
39 private function load(): void
40 {
42 $event->send();
43
44 foreach ($event->getResults() as $eventResult)
45 {
46 if ($eventResult->getType() === EventResult::ERROR)
47 {
48 continue;
49 }
50
51 $parameters = $eventResult->getParameters();
52 if (!is_array($parameters))
53 {
54 continue;
55 }
56
57 $type = $parameters['type'] ?? null;
58 $config = $parameters['config'] ?? new Config();
59
60 if (!is_string($type) || !$type)
61 {
62 continue;
63 }
64
65 $this->registry[$type] = $config;
66 }
67 }
68}
$type
Определения options.php:106
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$event
Определения prolog_after.php:141
$config
Определения quickway.php:69