Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
servicepool.php
1
<?php
2
3
namespace
Bitrix\Seo\BusinessSuite\Utils
;
4
5
use
Bitrix\Seo\BusinessSuite\ServiceAdapter
;
6
use
Bitrix\Seo\BusinessSuite\ServiceMetaData
;
7
use
Bitrix\Seo\BusinessSuite\ServiceWrapper
;
8
9
final
class
ServicePool
10
{
11
private
static
function
buildService($type, $clientId, $serviceType) : ?
ServiceWrapper
12
{
13
if
(is_string($type) && $clientId && is_string($serviceType))
14
{
15
return
ServiceAdapter::createServiceWrapperContainer
()->
setMeta
(
16
ServiceMetaData::create
()
17
->setType($type)
18
->setEngineCode($serviceType)
19
->setClientId($clientId)
20
->setService(
ServiceFactory::getServiceByEngineCode
($serviceType))
21
);
22
}
23
return
null
;
24
}
25
33
public
static
function
getService
($type) : ?
ServiceWrapper
34
{
35
$types = (is_array($type)? $type : [$type]);
36
foreach
($types as $type)
37
{
38
while
($data =
ServiceQueue::getInstance
($type)->getHead())
39
{
40
try
41
{
42
$wrapper = static::buildService($data[
'TYPE'
],$data[
'CLIENT_ID'
],$data[
'SERVICE_TYPE'
]);
43
}
44
finally
45
{
46
if
($wrapper && $wrapper::getAuthAdapter($type)->hasAuth())
47
{
48
return
$wrapper;
49
}
50
ServiceQueue::getInstance
($type)->removeHead();
51
}
52
}
53
}
54
return
null
;
55
}
56
57
}
Bitrix\Seo\BusinessSuite\ServiceAdapter
Definition
serviceadapter.php:10
Bitrix\Seo\BusinessSuite\ServiceAdapter\createServiceWrapperContainer
static createServiceWrapperContainer()
Definition
serviceadapter.php:30
Bitrix\Seo\BusinessSuite\ServiceMetaData
Definition
servicemetadata.php:8
Bitrix\Seo\BusinessSuite\ServiceMetaData\create
static create()
Definition
servicemetadata.php:25
Bitrix\Seo\BusinessSuite\ServiceWrapper
Definition
servicewrapper.php:11
Bitrix\Seo\BusinessSuite\ServiceWrapper\setMeta
setMeta(?ServiceMetaData $metaData)
Definition
servicewrapper.php:164
Bitrix\Seo\BusinessSuite\Utils\ServiceFactory\getServiceByEngineCode
static getServiceByEngineCode(string $engineCode)
Definition
servicefactory.php:54
Bitrix\Seo\BusinessSuite\Utils\ServicePool
Definition
servicepool.php:10
Bitrix\Seo\BusinessSuite\Utils\ServicePool\getService
static getService($type)
Definition
servicepool.php:33
Bitrix\Seo\BusinessSuite\Utils\ServiceQueue\getInstance
static getInstance(string $type)
Definition
servicequeue.php:18
Bitrix\Seo\BusinessSuite\Utils
Definition
queueeventhandler.php:3
modules
seo
lib
businesssuite
utils
servicepool.php
Создано системой
1.10.0