1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
servicewrapper.php
См. документацию.
1<?php
2
3namespace Bitrix\Seo\BusinessSuite;
4
5
6use Bitrix\Main\NotImplementedException;
7use Bitrix\Seo\Retargeting;
8use Bitrix\Seo\BusinessSuite\AuthAdapter\Facebook\BusinessAuthAdapter;
9
11{
13 protected $metaData;
14
16 protected static $authAdapterPool = [];
17
19 protected static $instance = [];
20
21 private function __construct()
22 {}
23
24 private function __clone()
25 {}
26
31 public static function getInstance(): ServiceWrapper
32 {
33 if (!static::$instance[$key = get_called_class()])
34 {
35 static::$instance[$key] = new static();
36 }
37
38 return static::$instance[$key];
39 }
40
44 public static function canUseMultipleClients() : ?bool
45 {
46 $internal = static::getInstance()->getMetaData()->getService();
47 return $internal instanceof Retargeting\IMultiClientService && $internal::canUseMultipleClients();
48 }
49
53 public function getClientId(): string
54 {
55 return $this->metaData->getClientId();
56 }
57
64 public function setClientId($clientId)
65 {
66 throw new NotImplementedException("method not implement");
67 }
68
74 public static function getEngineCode($type) : ?string
75 {
76 if($service = static::getInstance()->getMetaData()->getService())
77 {
78
79 return $service::getEngineCode($type);
80 }
81
82 return null;
83 }
84
88 public static function getTypes() : ?array
89 {
90 if($service = static::getInstance()->getMetaData()->getService())
91 {
92
93 return $service::getTypes();
94 }
95
96 return null;
97 }
98
105 public static function getAuthAdapter($type) : BusinessAuthAdapter
106 {
107 static::$authAdapterPool[$key] = static::$authAdapterPool[$key = get_called_class()] ?? [];
108 if (!array_key_exists($type,static::$authAdapterPool[$key]))
109 {
110 static::$authAdapterPool[$key][$type] = BusinessAuthAdapter::create(
111 type: $type,
112 ignoreType: true,
113 )->setService(static::getInstance());
114 }
115
116 return static::$authAdapterPool[$key][$type];
117 }
118
122 public static function getTypeByEngine(string $engineCode): ?string
123 {
124 if($service = static::getInstance()->getMetaData()->getService())
125 {
126
127 return $service::getTypeByEngine($engineCode);
128 }
129
130 return null;
131 }
132
136 public static function canUseAsInternal(): bool
137 {
138 if($service = static::getInstance()->getMetaData()->getService())
139 {
140
141 return $service::canUseAsInternal();
142 }
143
144 return false;
145 }
146
150 public static function getMethodPrefix(): string
151 {
152 if(($meta = static::getInstance()->getMetaData()) && $service = $meta->getService())
153 {
154 return $service::getMethodPrefix();
155 }
156
157 return '';
158 }
159
168 {
169 $this->metaData = $metaData;
170
171 return $this;
172 }
173
178 public function getMetaData() : ?ServiceMetaData
179 {
180 return $this->metaData;
181 }
182};
$type
Определения options.php:106
static getEngineCode($type)
Определения servicewrapper.php:74
static getTypeByEngine(string $engineCode)
Определения servicewrapper.php:122
setMeta(?ServiceMetaData $metaData)
Определения servicewrapper.php:167
static getAuthAdapter($type)
Определения servicewrapper.php:105
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$service
Определения payment.php:18
if(empty($signedUserToken)) $key
Определения quickway.php:257
$clientId
Определения seo_client.php:18