1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
servicepool.php
См. документацию.
1<?php
2
3namespace Bitrix\Seo\BusinessSuite\Utils;
4
5use Bitrix\Seo\BusinessSuite\ServiceAdapter;
6use Bitrix\Seo\BusinessSuite\ServiceMetaData;
7use Bitrix\Seo\BusinessSuite\ServiceWrapper;
8
9final class ServicePool
10{
11 private static function buildService($type, $clientId, $serviceType) : ?ServiceWrapper
12 {
13 if (is_string($type) && $clientId && is_string($serviceType))
14 {
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}
$type
Определения options.php:106
static createServiceWrapperContainer()
Определения serviceadapter.php:30
static getServiceByEngineCode(string $engineCode)
Определения servicefactory.php:54
static getInstance(string $type)
Определения servicequeue.php:18
$data['IS_AVAILABLE']
Определения .description.php:13
$clientId
Определения seo_client.php:18