forked from YetiForceCompany/iCalendar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIcalendarPropertyDtstart.php
More file actions
43 lines (36 loc) · 916 Bytes
/
Copy pathIcalendarPropertyDtstart.php
File metadata and controls
43 lines (36 loc) · 916 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
class IcalendarPropertyDtstart extends IcalendarProperty
{
public $name = 'DTSTART';
public $val_type = RFC2445_TYPE_DATE_TIME;
public function construct()
{
$this->valid_parameters = [
'VALUE' => RFC2445_OPTIONAL | RFC2445_ONCE,
'TZID' => RFC2445_OPTIONAL | RFC2445_ONCE,
RFC2445_XNAME => RFC2445_OPTIONAL,
];
}
public function isValidValue($value)
{
if (!parent::isValidValue($value)) {
return false;
}
// If present in a FREEBUSY component, must be in UTC format
if ($this->parent_component == 'VFREEBUSY' && substr($value, -1) != 'Z') {
return false;
}
return true;
}
public function isValidParameter($parameter, $value)
{
$parameter = strtoupper($parameter);
if (!parent::isValidParameter($parameter, $value)) {
return false;
}
if ($parameter == 'VALUE' && !($value == 'DATE' || $value == 'DATE-TIME')) {
return false;
}
return true;
}
}