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/trading/settings/options/ |
Upload File : |
<?php namespace Yandex\Market\Trading\Settings\Options; class SkuMap { /** @var array{IBLOCK: int, FIELD: string}[] */ private $fieldMap; /** @var string|null */ private $prefix; public function __construct($fieldMap, $prefix = null) { $this->fieldMap = $this->castFieldMap($fieldMap); $this->prefix = $this->castPrefix($prefix); } public function getIblockIds() { return array_values(array_column($this->fieldMap, 'IBLOCK', 'IBLOCK')); } public function getFieldMap() { return $this->fieldMap; } public function getPrefix() { return $this->prefix; } private function castFieldMap($fieldMap) { if (!is_array($fieldMap)) { return []; } $result = []; foreach ($fieldMap as $iblockMap) { if (empty($iblockMap['IBLOCK']) || empty($iblockMap['FIELD'])) { continue; } $result[] = [ 'IBLOCK' => (int)$iblockMap['IBLOCK'], 'FIELD' => (string)$iblockMap['FIELD'], ]; } return $result; } private function castPrefix($prefix) { if ($prefix === null) { return null; } $prefix = trim($prefix); if ($prefix === '') { return null; } return $prefix; } }