Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
format.php
1<?php
2
4
12
17final class Format
18{
20 private $name = '';
22 private $description = '';
24 private $code = '';
26 private $languageId;
28 private $delimiter = '';
30 private $fieldForUnRecognized = FieldType::UNKNOWN;
32 private $fieldCollection;
34 private $templateCollection;
35
40 public function __construct(string $languageId)
41 {
42 $this->languageId = $languageId;
43 $this->fieldCollection = new FieldCollection();
44 $this->templateCollection = new TemplateCollection();
45 }
46
50 public function getName(): string
51 {
52 return $this->name;
53 }
54
59 public function setName(string $name): Format
60 {
61 $this->name = $name;
62 return $this;
63 }
64
68 public function getDescription(): string
69 {
70 return $this->description;
71 }
72
77 public function setDescription(string $description): Format
78 {
79 $this->description = $description;
80 return $this;
81 }
82
86 public function getLanguageId(): string
87 {
88 return $this->languageId;
89 }
90
95 public function setLanguageId(string $languageId): Format
96 {
97 $this->languageId = $languageId;
98 return $this;
99 }
100
104 public function getCode(): string
105 {
106 return $this->code;
107 }
108
113 public function setCode(string $code): Format
114 {
115 $this->code = $code;
116 return $this;
117 }
118
124 public function setFieldCollection(FieldCollection $fieldCollection): self
125 {
126 $this->fieldCollection = $fieldCollection;
127 return $this;
128 }
129
135 {
136 return $this->fieldCollection;
137 }
138
145 public function toJson(): string
146 {
147 return Json::encode(ArrayConverter::convertToArray($this));
148 }
149
154 public function getTemplate(string $type = TemplateType::DEFAULT): ?Template
155 {
156 return $this->templateCollection->getTemplate($type);
157 }
158
164 {
165 return $this->templateCollection;
166 }
167
172 public function setTemplateCollection(TemplateCollection $templateCollection): self
173 {
174 $this->templateCollection = $templateCollection;
175 return $this;
176 }
177
181 public function getDelimiter(): string
182 {
183 return $this->delimiter;
184 }
185
190 public function setDelimiter(string $delimiter): self
191 {
192 $this->delimiter = $delimiter;
193 return $this;
194 }
195
200 public function setFieldForUnRecognized(int $fieldType): self
201 {
202 $this->fieldForUnRecognized = $fieldType;
203 return $this;
204 }
205
209 public function getFieldForUnRecognized(): int
210 {
211 return $this->fieldForUnRecognized;
212 }
213}
getTemplate(string $type=TemplateType::DEFAULT)
Definition format.php:154
setDescription(string $description)
Definition format.php:77
setFieldForUnRecognized(int $fieldType)
Definition format.php:200
setTemplateCollection(TemplateCollection $templateCollection)
Definition format.php:172
setDelimiter(string $delimiter)
Definition format.php:190
setLanguageId(string $languageId)
Definition format.php:95
__construct(string $languageId)
Definition format.php:40
setFieldCollection(FieldCollection $fieldCollection)
Definition format.php:124