Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/seo/lib/businesssuite/utils/ |
Upload File : |
<?php namespace Bitrix\Seo\BusinessSuite\Utils; use Bitrix\Seo\BusinessSuite\ServiceAdapter; use Bitrix\Seo\BusinessSuite\ServiceMetaData; use Bitrix\Seo\BusinessSuite\ServiceWrapper; final class ServicePool { private static function buildService($type, $clientId, $serviceType) : ?ServiceWrapper { if (is_string($type) && $clientId && is_string($serviceType)) { return ServiceAdapter::createServiceWrapperContainer()->setMeta( ServiceMetaData::create() ->setType($type) ->setEngineCode($serviceType) ->setClientId($clientId) ->setService(ServiceFactory::getServiceByEngineCode($serviceType)) ); } return null; } /** * build service Wrapper * @param array|string $type * * @return ServiceWrapper|null * @throws \Bitrix\Main\SystemException */ public static function getService($type) : ?ServiceWrapper { $types = (is_array($type)? $type : [$type]); foreach ($types as $type) { while ($data = ServiceQueue::getInstance($type)->getHead()) { try { $wrapper = static::buildService($data['TYPE'],$data['CLIENT_ID'],$data['SERVICE_TYPE']); } finally { if ($wrapper && $wrapper::getAuthAdapter($type)->hasAuth()) { return $wrapper; } ServiceQueue::getInstance($type)->removeHead(); } } } return null; } }