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/location/lib/repository/ |
Upload File : |
<?php namespace Bitrix\Location\Repository; use Bitrix\Location\Entity; use Bitrix\Location\Repository\Format\DataCollection; use Bitrix\Location\Entity\Format\Converter\ArrayConverter; /** * Class FormatRepository * @package Bitrix\Location\Repository */ class FormatRepository { /** @var DataCollection */ protected $dataCollection; /** * FormatRepository constructor. * @param array $params */ public function __construct(array $params = []) { if(isset($params['dataCollection']) && is_subclass_of($params['dataCollection'], DataCollection::class)) { $this->dataCollection = $params['dataCollection']; } else { $this->dataCollection = DataCollection::class; } } /** * @param string $language * @return array */ public function findAll(string $language): array { $result = []; foreach ($this->dataCollection::getAll($language) as $data) { $result[] = ArrayConverter::convertFromArray($data, $language); } return $result; } /** * @param string $code * @param string $languageId * @return FormatRepository|null */ public function findByCode(string $code, string $languageId):? Entity\Format { $data = $this->dataCollection::getByCode($code, $languageId); return is_array($data) ? ArrayConverter::convertFromArray($data, $languageId) : null; } }