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/cvetdv.ru/bitrix/modules/yandex.market/lib/template/functions/ |
Upload File : |
<?php namespace Yandex\Market\Template\Functions; use Bitrix\Main; class Registry { const FUNCTION_NOT = 'not'; const FUNCTION_SUM = 'sum'; const FUNCTION_TOTAL = 'total'; const FUNCTION_SUBTRACT = 'subtract'; const FUNCTION_MULTIPLY = 'multiply'; const FUNCTION_IF = 'if'; const FUNCTION_FIRST = 'first'; const FUNCTION_CHARACTERISTIC = 'characteristic'; const FUNCTION_ROUND = 'round'; const FUNCTION_FLOOR = 'floor'; const FUNCTION_CEIL = 'ceil'; const FUNCTION_SPLIT = 'split'; const FUNCTION_REPLACE = 'replace'; protected static $typeMap; public static function getTypes() { return [ static::FUNCTION_TOTAL, static::FUNCTION_SUM, static::FUNCTION_FIRST, static::FUNCTION_NOT, static::FUNCTION_SUBTRACT, static::FUNCTION_MULTIPLY, static::FUNCTION_IF, static::FUNCTION_CHARACTERISTIC, static::FUNCTION_ROUND, static::FUNCTION_FLOOR, static::FUNCTION_CEIL, static::FUNCTION_SPLIT, static::FUNCTION_REPLACE, ]; } public static function isExists($type) { if (static::$typeMap === null) { static::$typeMap = array_flip(static::getTypes()); } return isset(static::$typeMap[$type]); } public static function createInstance($type, $data = null) { $className = static::getTypeClassName($type); return new $className($data); } protected static function getTypeClassName($type) { $result = __NAMESPACE__ . '\Function' . ucfirst($type); if (!class_exists($result)) { throw new Main\SystemException($result . ' not found'); } return $result; } }