1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
ExternalTypeRegistry.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Im\V2\Chat\ExternalChat;
4
5
use Bitrix\Im\V2\Chat\ExternalChat\Event\RegisterTypeEvent;
6
use Bitrix\Main\EventResult;
7
8
class
ExternalTypeRegistry
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
{
41
$event
=
new
RegisterTypeEvent
();
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
$type
Определения
options.php:106
Bitrix\Im\V2\Chat\ExternalChat\Config
Определения
Config.php:6
Bitrix\Im\V2\Chat\ExternalChat\Event\RegisterTypeEvent
Определения
RegisterTypeEvent.php:8
Bitrix\Im\V2\Chat\ExternalChat\ExternalTypeRegistry
Определения
ExternalTypeRegistry.php:9
Bitrix\Im\V2\Chat\ExternalChat\ExternalTypeRegistry\getConfigs
getConfigs()
Определения
ExternalTypeRegistry.php:29
Bitrix\Im\V2\Chat\ExternalChat\ExternalTypeRegistry\getConfigByType
getConfigByType(string $type)
Определения
ExternalTypeRegistry.php:34
Bitrix\Im\V2\Chat\ExternalChat\ExternalTypeRegistry\getInstance
static getInstance()
Определения
ExternalTypeRegistry.php:22
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
Bitrix\Main\Config
Определения
configuration.php:3
$event
$event
Определения
prolog_after.php:141
$config
$config
Определения
quickway.php:69
bitrix
modules
im
lib
V2
Chat
ExternalChat
ExternalTypeRegistry.php
Создано системой
1.14.0