1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
Container.php
См. документацию.
1<?php
2
3declare(strict_types=1);
4
5namespace Bitrix\Rest\Repository;
6
7use Bitrix\Main\DI\ServiceLocator;
8use Bitrix\Main\ObjectNotFoundException;
9use Psr\Container\NotFoundExceptionInterface;
10
12{
13 private static Container $instance;
14 private ServiceLocator $serviceLocator;
15 private string $prefix;
16
17 private function __construct()
18 {
19 $this->serviceLocator = ServiceLocator::getInstance();
20 $this->prefix = 'rest.repository.';
21 }
22
23 private function __clone()
24 {}
25
26 public static function getInstance(): self
27 {
28 if (!isset(self::$instance))
29 {
30 self::$instance = new self();
31 }
32
33 return self::$instance;
34 }
35
36 public function has(string $id): bool
37 {
38 return $this->serviceLocator->has($this->prefix . $id);
39 }
40
45 public function get(string $id): mixed
46 {
47 return $this->serviceLocator->get($this->prefix . $id);
48 }
49
51 {
52 return $this->get('app');
53 }
54
56 {
57 return $this->get('integration');
58 }
59}
getIntegrationRepository()
Определения Container.php:55
getApplicationRepository()
Определения Container.php:50
has(string $id)
Определения Container.php:36
static getInstance()
Определения Container.php:26