%PDF- %PDF-
Server IP : 37.220.80.31 / Your IP : 18.222.117.15 Web Server : Apache/2.4.52 (Ubuntu) System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64 User : www-root ( 1010) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/sale/lib/exchange/ |
Upload File : |
<?php namespace Bitrix\Sale\Exchange; /** @depricate */ use Bitrix\Main\ArgumentOutOfRangeException; use Bitrix\Sale\Exchange\Internals\LoggerDiag; use Bitrix\Sale\Exchange\OneC\ImportCollision; use Bitrix\Sale\Exchange\OneC\ImportCriterionBase; final class Manager { private static $instance = null; /** @var ISettings $settings */ protected $settings = null; /** @var ICollision $collision */ protected $collision = null; /** @var ICriterion $criterion */ protected $criterion = null; /** @var LoggerDiag $logger */ protected $logger = null; /** * @return static */ private static function getInstance() { if(self::$instance === null) { self::$instance = new static(); } return self::$instance; } /** * @param $typeId * @return Entity\OrderImport|Entity\PaymentCardImport|Entity\PaymentCashImport|Entity\PaymentCashLessImport|Entity\ShipmentImport|Entity\UserProfileImport|ProfileImport */ public static function createImport($typeId) { $config = static::getImportByType($typeId); $import = Entity\EntityImportFactory::create($typeId); $import->loadSettings($config->settings); $import->loadCollision($config->collision); $import->loadCriterion($config->criterion); $import->loadLogger($config->logger); return $import; } /** * Add instance of this manager to collection * @param $typeId * @param ISettings $settings * @param ICollision $collision * @param ICriterion $criterion * @return mixed * @throws ArgumentOutOfRangeException * @internal */ static public function registerInstance($typeId, ISettings $settings, ICollision $collision = null, ICriterion $criterion = null) { if(!is_int($typeId)) { $typeId = (int)$typeId; } if(!EntityType::IsDefined($typeId)) { throw new ArgumentOutOfRangeException('Is not defined', EntityType::FIRST, EntityType::LAST); } if(self::$instance[$typeId] === null) { $manager = new static(); $manager->settings = $settings; $manager->collision = $collision !== null ? $collision : new ImportCollision(); $manager->criterion = $criterion !== null ? $criterion : new ImportCriterionBase(); $manager->logger = new LoggerDiag(); self::$instance[$typeId] = $manager; } return self::$instance[$typeId]; } /** * Get import by Type ID. * @param $typeId * @return null|static * @throws ArgumentOutOfRangeException */ private static function getImportByType($typeId) { if(!is_int($typeId)) { $typeId = (int)$typeId; } if(!EntityType::IsDefined($typeId)) { throw new ArgumentOutOfRangeException('Is not defined', EntityType::FIRST, EntityType::LAST); } $import = static::getInstance(); return isset($import[$typeId]) ? $import[$typeId] : null; } /** * @param $typeId * @return ISettings * @throws ArgumentOutOfRangeException */ public static function getSettingsByType($typeId) { if(!is_int($typeId)) { $typeId = (int)$typeId; } if(!EntityType::IsDefined($typeId)) { throw new ArgumentOutOfRangeException('Is not defined', EntityType::FIRST, EntityType::LAST); } $config = static::getImportByType($typeId); return $config->settings; } }