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/utils/ |
Upload File : |
<?php namespace Yandex\Market\Utils; use Bitrix\Main; use Yandex\Market\Data\TextString; class MessageRegistry { private static $moduleInstance; private $classFinder; private $prefix; private $prefixes = []; private $included = []; /** @return MessageRegistry */ public static function getModuleInstance() { if (static::$moduleInstance === null) { static::$moduleInstance = new static(ClassFinder::forModule()); } return static::$moduleInstance; } public function __construct(ClassFinder $classFinder, $prefix = '') { $this->classFinder = $classFinder; $this->prefix = $prefix; } public function load($className) { if (isset($this->included[$className])) { return; } $path = $this->classFinder->getPath($className); Main\Localization\Loc::loadMessages($path); $this->included[$className] = true; } public function getPrefix($className) { if (!isset($this->prefixes[$className])) { $this->prefixes[$className] = $this->makePrefixes($className); } return $this->prefixes[$className][0]; } public function getCompatiblePrefix($className) { if (!isset($this->prefixes[$className])) { $this->prefixes[$className] = $this->makePrefixes($className); } return $this->prefixes[$className][1]; } private function makePrefixes($className) { $relativeName = $this->classFinder->getRelativeName($className); return [ $this->prefix . Name::screamingSnakeCase($relativeName), $this->prefix . mb_strtoupper(str_replace('\\', '_', $relativeName)), ]; } }