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/entity/ |
Upload File : |
<?php namespace Bitrix\Location\Entity; use Bitrix\Location\Entity\Address\FieldType; use Bitrix\Location\Entity\Format\Converter\ArrayConverter; use Bitrix\Location\Entity\Format\FieldCollection; use Bitrix\Location\Entity\Format\Template; use Bitrix\Location\Entity\Format\TemplateCollection; use Bitrix\Location\Entity\Format\TemplateType; use Bitrix\Main\Web\Json; /** * Class Format * @package Bitrix\Location\Entity */ final class Format { /** @var string */ private $name = ''; /** @var string */ private $description = ''; /** @var string */ private $code = ''; /** @var string */ private $languageId; /** @var string Address components delimiter */ private $delimiter = ''; /** @var int Address field which will store unrecognized address information */ private $fieldForUnRecognized = FieldType::UNKNOWN; /** @var FieldCollection */ private $fieldCollection; /** @var TemplateCollection */ private $templateCollection; /** * Format constructor. * @param string $languageId */ public function __construct(string $languageId) { $this->languageId = $languageId; $this->fieldCollection = new FieldCollection(); $this->templateCollection = new TemplateCollection(); } /** * @return string */ public function getName(): string { return $this->name; } /** * @param string $name * @return $this */ public function setName(string $name): Format { $this->name = $name; return $this; } /** * @return string */ public function getDescription(): string { return $this->description; } /** * @param string $description * @return $this */ public function setDescription(string $description): Format { $this->description = $description; return $this; } /** * @return string */ public function getLanguageId(): string { return $this->languageId; } /** * @param string $languageId * @return $this */ public function setLanguageId(string $languageId): Format { $this->languageId = $languageId; return $this; } /** * @return string */ public function getCode(): string { return $this->code; } /** * @param string $code * @return $this */ public function setCode(string $code): Format { $this->code = $code; return $this; } /** * @param FieldCollection $fieldCollection * @return $this * @internal */ public function setFieldCollection(FieldCollection $fieldCollection): self { $this->fieldCollection = $fieldCollection; return $this; } /** * @return FieldCollection * @internal */ public function getFieldCollection(): FieldCollection { return $this->fieldCollection; } /** * Convert Format to JSON * * @return string * @throws \Bitrix\Main\ArgumentException */ public function toJson(): string { return Json::encode(ArrayConverter::convertToArray($this)); } /** * @param string $type See TemplateType * @return Template|null */ public function getTemplate(string $type = TemplateType::DEFAULT): ?Template { return $this->templateCollection->getTemplate($type); } /** * @return TemplateCollection * @internal */ public function getTemplateCollection(): TemplateCollection { return $this->templateCollection; } /** * @param TemplateCollection $templateCollection * @return $this */ public function setTemplateCollection(TemplateCollection $templateCollection): self { $this->templateCollection = $templateCollection; return $this; } /** * @return string */ public function getDelimiter(): string { return $this->delimiter; } /** * @param string $delimiter * @return $this */ public function setDelimiter(string $delimiter): self { $this->delimiter = $delimiter; return $this; } /** * @param int $fieldType * @return $this */ public function setFieldForUnRecognized(int $fieldType): self { $this->fieldForUnRecognized = $fieldType; return $this; } /** * @return int */ public function getFieldForUnRecognized(): int { return $this->fieldForUnRecognized; } }