1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
AnchorContainer.php
См. документацию.
1<?php
2
3declare(strict_types=1);
4
6
14
15final class AnchorContainer
16{
17 private static ?self $instance = null;
18
19 public static function getInstance(): self
20 {
21 if (self::$instance === null)
22 {
23 self::$instance = new self();
24 }
25
26 return self::$instance;
27 }
28
30 {
31 return $this->get(
32 static fn (): AnchorService => new AnchorService($message),
33 'im.anchor.service.' . $message->getId()
34 );
35 }
36
37 public function getReadService(): ReadService
38 {
39 return $this->get(ReadService::class, 'im.anchor.read.service');
40 }
41
43 {
44 return $this->get(AnchorProvider::class, 'im.anchor.provider');
45 }
46
47 public function getPushService(): PushService
48 {
49 return $this->get(PushService::class, 'im.anchor.push.service');
50 }
51
52 private function get(string|callable $constructor, string $id, array $args = []): object
53 {
54 $locator = ServiceLocator::getInstance();
55
56 if (!$locator->has($id))
57 {
58 $config = [
59 'constructorParams' => $args,
60 is_callable($constructor) ? 'constructor' : 'className' => $constructor,
61 ];
62
63 $locator->addInstanceLazy($id, $config);
64 }
65
66 return $locator->get($id);
67 }
68
69
70 private function __construct()
71 {
72 }
73
77 public function __clone()
78 {
79 throw new NotImplementedException();
80 }
81
85 public function __serialize(): array
86 {
87 throw new NotImplementedException();
88 }
89}
getAnchorService(Message $message)
Определения AnchorContainer.php:29
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
Определения Uuid.php:3
$message
Определения payment.php:8
$config
Определения quickway.php:69