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/sale/lib/exchange/onec/ |
Upload File : |
<?php namespace Bitrix\Sale\Exchange\OneC; use Bitrix\Main\ArgumentNullException; use Bitrix\Main\ArgumentTypeException; use Bitrix\Main\NotImplementedException; use Bitrix\Main\NotSupportedException; use Bitrix\Sale\Exchange\EntityType; use Bitrix\Sale\Exchange\ISettings; abstract class SettingsBase implements ISettings { protected static $currentSettings = null; protected $settings = array(); /** * ImportSettings constructor. * @param array|null $settings */ protected function __construct(array $settings = null) { if($settings !== null) { $this->settings = $settings; } } /** * @param $entityTypeId * @return string * @throws ArgumentTypeException * @throws NotSupportedException */ protected function resolveName($entityTypeId) { if(!is_int($entityTypeId)) { throw new ArgumentTypeException('entityTypeID', 'integer'); } if(!EntityType::IsDefined($entityTypeId)) { throw new NotSupportedException("Entity ID: '{$entityTypeId}' is not supported in current context"); } return EntityType::ResolveName($entityTypeId); } /** * @return array|null * @throws ArgumentNullException */ static protected function loadCurrentSettings() { throw new NotImplementedException('The method is not implemented.'); } /** * @param $entityTypeId * @param $name * @param string $default * @return string */ protected function getValueFor($entityTypeId, $name, $default='') { $entityTypeName = $this->resolveName($entityTypeId); return (isset($this->settings[$name][$entityTypeName]) ? $this->settings[$name][$entityTypeName]: $default); } /** * @param $entityTypeId * @return mixed * @throws ArgumentTypeException * @throws NotSupportedException */ public function prefixFor($entityTypeId) { return $this->getValueFor($entityTypeId, 'accountNumberPrefix'); } }