Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
calendar.php
1<?php
2
3
5
6
8{
9 public const COMPONENT_TYPE = 'VCALENDAR';
13 private $events = [];
17 private $timezones = [];
21 private $name;
25 private $productIdentifier;
29 private $method;
33 private $version;
37 private $calScale;
38
43 public static function createInstance(string $name = ''): Calendar
44 {
45 return new self($name);
46 }
47
52 public function __construct($name)
53 {
54 $this->name = $name;
55 }
56
60 public function getType(): string
61 {
63 }
64
68 public function getProperties(): array
69 {
70 return [];
71 }
72
77 public function setMethod(?ParserPropertyType $method): Calendar
78 {
79 $this->method = $method;
80
81 return $this;
82 }
83
88 public function setProdId(?ParserPropertyType $prodId): Calendar
89 {
90 $this->productIdentifier = $prodId;
91
92 return $this;
93 }
94
99 public function setCalScale(?ParserPropertyType $calscale): Calendar
100 {
101 $this->calScale = $calscale;
102
103 return $this;
104 }
105
110 public function setVersion(?ParserPropertyType $version): Calendar
111 {
112 $this->version = $version;
113
114 return $this;
115 }
116
121 public function setEvent(Event $event): Calendar
122 {
123 $this->events[] = $event;
124
125 return $this;
126 }
127
132 public function setSubComponents(iterable $subComponents): Calendar
133 {
134 foreach ($subComponents as $subComponent)
135 {
136 if ($subComponent instanceof ParserComponent)
137 {
138 if ($subComponent instanceof Event)
139 {
140 $this->events[] = $subComponent;
141 }
142 elseif($subComponent instanceof Timezone)
143 {
144 $this->timezones[] = $subComponent;
145 }
146 }
147 }
148
149 return $this;
150 }
151
155 public function getContent(): Calendar
156 {
157 return $this;
158 }
159
163 public function getEvents(): array
164 {
165 return $this->events;
166 }
167
171 public function getProdId(): ?string
172 {
173 if ($this->productIdentifier instanceof ParserPropertyType)
174 {
175 return $this->productIdentifier->getValue();
176 }
177
178 return null;
179 }
180
184 public function getVersion(): ?string
185 {
186 if ($this->version instanceof ParserPropertyType)
187 {
188 return $this->version->getValue();
189 }
190
191 return null;
192 }
193
197 public function getTimezones(): array
198 {
199 return $this->timezones;
200 }
201
205 public function getMethod(): ?string
206 {
207 if ($this->method instanceof ParserPropertyType)
208 {
209 return $this->method->getValue();
210 }
211
212 return null;
213 }
214
218 public function getCalScale(): ?ParserPropertyType
219 {
220 return $this->calScale;
221 }
222
226 public function countEvents(): int
227 {
228 return count($this->events);
229 }
230
234 public function getName(): string
235 {
236 return $this->name;
237 }
238
242 public function hasOneEvent(): bool
243 {
244 return $this->countEvents() === 1;
245 }
246
250 public function getEvent(): Event
251 {
252 return $this->events[0];
253 }
254}
setProdId(?ParserPropertyType $prodId)
Definition calendar.php:88
setVersion(?ParserPropertyType $version)
Definition calendar.php:110
setSubComponents(iterable $subComponents)
Definition calendar.php:132
static createInstance(string $name='')
Definition calendar.php:43
setCalScale(?ParserPropertyType $calscale)
Definition calendar.php:99
setMethod(?ParserPropertyType $method)
Definition calendar.php:77