Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
calendar.php
1
<?php
2
3
4
namespace
Bitrix\Calendar\ICal\Parser
;
5
6
7
class
Calendar
extends
ParserComponent
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
{
62
return
self::COMPONENT_TYPE
;
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
}
Bitrix\Calendar\ICal\Parser\Calendar
Definition
calendar.php:8
Bitrix\Calendar\ICal\Parser\Calendar\getEvent
getEvent()
Definition
calendar.php:250
Bitrix\Calendar\ICal\Parser\Calendar\getTimezones
getTimezones()
Definition
calendar.php:197
Bitrix\Calendar\ICal\Parser\Calendar\setProdId
setProdId(?ParserPropertyType $prodId)
Definition
calendar.php:88
Bitrix\Calendar\ICal\Parser\Calendar\setVersion
setVersion(?ParserPropertyType $version)
Definition
calendar.php:110
Bitrix\Calendar\ICal\Parser\Calendar\getName
getName()
Definition
calendar.php:234
Bitrix\Calendar\ICal\Parser\Calendar\__construct
__construct($name)
Definition
calendar.php:52
Bitrix\Calendar\ICal\Parser\Calendar\COMPONENT_TYPE
const COMPONENT_TYPE
Definition
calendar.php:9
Bitrix\Calendar\ICal\Parser\Calendar\hasOneEvent
hasOneEvent()
Definition
calendar.php:242
Bitrix\Calendar\ICal\Parser\Calendar\countEvents
countEvents()
Definition
calendar.php:226
Bitrix\Calendar\ICal\Parser\Calendar\setSubComponents
setSubComponents(iterable $subComponents)
Definition
calendar.php:132
Bitrix\Calendar\ICal\Parser\Calendar\getEvents
getEvents()
Definition
calendar.php:163
Bitrix\Calendar\ICal\Parser\Calendar\getContent
getContent()
Definition
calendar.php:155
Bitrix\Calendar\ICal\Parser\Calendar\createInstance
static createInstance(string $name='')
Definition
calendar.php:43
Bitrix\Calendar\ICal\Parser\Calendar\getCalScale
getCalScale()
Definition
calendar.php:218
Bitrix\Calendar\ICal\Parser\Calendar\getProdId
getProdId()
Definition
calendar.php:171
Bitrix\Calendar\ICal\Parser\Calendar\setEvent
setEvent(Event $event)
Definition
calendar.php:121
Bitrix\Calendar\ICal\Parser\Calendar\setCalScale
setCalScale(?ParserPropertyType $calscale)
Definition
calendar.php:99
Bitrix\Calendar\ICal\Parser\Calendar\getType
getType()
Definition
calendar.php:60
Bitrix\Calendar\ICal\Parser\Calendar\getProperties
getProperties()
Definition
calendar.php:68
Bitrix\Calendar\ICal\Parser\Calendar\setMethod
setMethod(?ParserPropertyType $method)
Definition
calendar.php:77
Bitrix\Calendar\ICal\Parser\Calendar\getMethod
getMethod()
Definition
calendar.php:205
Bitrix\Calendar\ICal\Parser\Calendar\getVersion
getVersion()
Definition
calendar.php:184
Bitrix\Calendar\ICal\Parser\Event
Definition
event.php:8
Bitrix\Calendar\ICal\Parser\ParserComponent
Definition
parsercomponent.php:10
Bitrix\Calendar\ICal\Parser\ParserPropertyType
Definition
parserpropertytype.php:8
Bitrix\Calendar\ICal\Parser\Timezone
Definition
timezone.php:8
Bitrix\Calendar\ICal\Parser
Definition
calendar.php:4
modules
calendar
lib
ical
parser
calendar.php
Создано системой
1.10.0