Your IP : 3.128.199.62


Current Path : /var/www/www-root/data/www/monolith-realty.ru/bitrix/modules/seo/lib/checkout/services/
Upload File :
Current File : /var/www/www-root/data/www/monolith-realty.ru/bitrix/modules/seo/lib/checkout/services/factory.php

<?php

namespace Bitrix\Seo\Checkout\Services;

use Bitrix\Main;
use Bitrix\Seo;

/**
 * Class Factory
 * @package Bitrix\Seo\Checkout\Services
 */
class Factory
{
	/**
	 * @param string $type
	 * @return AccountYandex|AccountYookassa
	 * @throws Main\SystemException
	 */
	public static function createService(string $type)
	{
		$oauthService = null;

		if ($type === AccountYandex::TYPE_CODE)
		{
			$oauthService = new AccountYandex();
		}

		if ($type === AccountYookassa::TYPE_CODE)
		{
			$oauthService = new AccountYookassa();
		}

		if ($oauthService)
		{
			$oauthService->setService(Seo\Checkout\Service::getInstance());
			return $oauthService;
		}

		throw new Main\SystemException("Service with type: \"{$type}\" not found");
	}
}