403Webshell
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/ilovecveti.ru/bitrix/modules/seo/lib/businesssuite/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/ilovecveti.ru/bitrix/modules/seo/lib/businesssuite/servicewrapper.php
<?php

namespace Bitrix\Seo\BusinessSuite;


use Bitrix\Main\NotImplementedException;
use Bitrix\Seo\Retargeting;
use Bitrix\Seo\BusinessSuite\AuthAdapter\Facebook\BusinessAuthAdapter;

class ServiceWrapper implements  Retargeting\IService, Retargeting\IMultiClientService, IInternalService
{
	/** @var ServiceMetaData $meta*/
	protected $metaData;

	/** @var BusinessAuthAdapter[] $authAdapterPool*/
	protected static $authAdapterPool = [];

	/** @var static $instance*/
	protected static $instance = [];

	private function __construct()
	{}

	private function __clone()
	{}

	/**
	 * Get instance of service Wrapper
	 * @return static
	 */
	public static function getInstance(): ServiceWrapper
	{
		if (!static::$instance[$key = get_called_class()])
		{
			static::$instance[$key] = new static();
		}

		return static::$instance[$key];
	}

	/**
	 * @return bool|null
	 */
	public static function canUseMultipleClients() : ?bool
	{
		$internal = static::getInstance()->getMetaData()->getService();
		return $internal instanceof Retargeting\IMultiClientService && $internal::canUseMultipleClients();
	}

	/**
	 * @return string
	 */
	public function getClientId(): string
	{
		return $this->metaData->getClientId();
	}

	/**
	 * @param string $clientId
	 *
	 * @return mixed|void
	 * @throws NotImplementedException
	 */
	public function setClientId($clientId)
	{
		throw new NotImplementedException("method not implement");
	}

	/**
	 * @param string $type
	 *
	 * @return string|null
	 */
	public static function getEngineCode($type) : ?string
	{
		if($service = static::getInstance()->getMetaData()->getService())
		{

			return $service::getEngineCode($type);
		}

		return null;
	}

	/**
	 * @return array|null
	 */
	public static function getTypes() : ?array
	{
		if($service = static::getInstance()->getMetaData()->getService())
		{

			return $service::getTypes();
		}

		return null;
	}

	/**
	 * @param string $type
	 *
	 * @return BusinessAuthAdapter
	 * @throws \Bitrix\Main\SystemException
	 */
	public static function getAuthAdapter($type) : BusinessAuthAdapter
	{
		static::$authAdapterPool[$key] =  static::$authAdapterPool[$key = get_called_class()] ?? [];
		if (!array_key_exists($type,static::$authAdapterPool[$key]))
		{
			static::$authAdapterPool[$key][$type] = BusinessAuthAdapter::create(
				type: $type,
				ignoreType: true,
			)->setService(static::getInstance());
		}

		return static::$authAdapterPool[$key][$type];
	}

	/**
	 * @inheritDoc
	 */
	public static function getTypeByEngine(string $engineCode): ?string
	{
		if($service = static::getInstance()->getMetaData()->getService())
		{

			return $service::getTypeByEngine($engineCode);
		}

		return null;
	}

	/**
	 * @inheritDoc
	 */
	public static function canUseAsInternal(): bool
	{
		if($service = static::getInstance()->getMetaData()->getService())
		{

			return $service::canUseAsInternal();
		}

		return false;
	}

	/**
	 * @inheritDoc
	 */
	public static function getMethodPrefix(): string
	{
		if(($meta = static::getInstance()->getMetaData()) && $service = $meta->getService())
		{
			return $service::getMethodPrefix();
		}

		return '';
	}

	/**
	 * set service meta
	 *
	 * @param ServiceMetaData|null $metaData
	 *
	 * @return ServiceWrapper
	 */
	public function setMeta(?ServiceMetaData $metaData): ServiceWrapper
	{
		$this->metaData = $metaData;

		return $this;
	}

	/**
	 * get service meta
	 * @return ServiceMetaData|null
	 */
	public function getMetaData() : ?ServiceMetaData
	{
		return $this->metaData;
	}
};

Youez - 2016 - github.com/yon3zu
LinuXploit