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/rospirotorg.ru/bitrix/modules/yandex.market/lib/data/holiday/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/yandex.market/lib/data/holiday/registry.php
<?php

namespace Yandex\Market\Data\Holiday;

use Bitrix\Main;
use Yandex\Market;

class Registry
{
	const NATIONAL = 'national';
	const PRODUCTION = 'production';
	const BLANK = 'blank';
	const MANUAL = 'manual';

	/** @var array<string, CalendarInterface>*/
	protected static $userMap;

	public static function types()
	{
		return array_merge(
			static::userTypes(),
			static::systemTypes()
		);
	}

	protected static function systemTypes()
	{
		return [
			static::PRODUCTION,
			static::NATIONAL,
			static::BLANK,
			static::MANUAL,
		];
	}

	protected static function userTypes()
	{
		$map = static::loadUserMap();

		return array_keys($map);
	}

	public static function instance($type)
	{
		if (in_array($type, static::systemTypes(), true))
		{
			$className = static::systemName($type);
		}
		else
		{
			$userMap = static::userMap();

			if (!isset($userMap[$type]))
			{
				throw new Main\SystemException(sprintf('unknown %s holiday calendar', $type));
			}

			$className = $userMap[$type];
		}

		Market\Reference\Assert::classExists($className);
		Market\Reference\Assert::isSubclassOf($className, CalendarInterface::class);

		return new $className();
	}

	protected static function systemName($type)
	{
		return __NAMESPACE__ . '\\' . ucfirst($type);
	}

	protected static function userMap()
	{
		if (static::$userMap === null)
		{
			static::$userMap = static::loadUserMap();
		}

		return static::$userMap;
	}

	protected static function loadUserMap()
	{
		$moduleName = Market\Config::getModuleName();
		$eventName = 'onHolidayCalendar';
		$result = [];

		$event = new Main\Event($moduleName, $eventName);
		$event->send();

		foreach ($event->getResults() as $eventResult)
		{
			if ($eventResult->getType() !== Main\EventResult::SUCCESS) { continue; }

			$parameters = $eventResult->getParameters();

			Market\Reference\Assert::isArray($parameters, 'eventResult->getParameters()');

			foreach ($parameters as $code => $calendar)
			{
				Market\Reference\Assert::classExists($calendar);
				Market\Reference\Assert::isSubclassOf($calendar, CalendarInterface::class);

				$result[$code] = $calendar;
			}
		}

		return $result;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit