30 $trigger = $this->TRIGGER;
31 if (!isset($trigger[
'VALUE']) || strtoupper($trigger[
'VALUE']) ===
'DURATION') {
33 $related = (isset($trigger[
'RELATED']) && strtoupper($trigger[
'RELATED']) ==
'END') ?
'END' :
'START';
36 if ($related ===
'START') {
38 if ($parentComponent->name ===
'VTODO') {
41 $propName =
'DTSTART';
44 $effectiveTrigger = $parentComponent->$propName->getDateTime();
45 $effectiveTrigger = $effectiveTrigger->add($triggerDuration);
47 if ($parentComponent->name ===
'VTODO') {
49 } elseif ($parentComponent->name ===
'VEVENT') {
52 throw new InvalidDataException(
'time-range filters on VALARM components are only supported when they are a child of VTODO or VEVENT');
55 if (isset($parentComponent->$endProp)) {
56 $effectiveTrigger = $parentComponent->$endProp->getDateTime();
57 $effectiveTrigger = $effectiveTrigger->add($triggerDuration);
58 } elseif (isset($parentComponent->DURATION)) {
59 $effectiveTrigger = $parentComponent->DTSTART->getDateTime();
61 $effectiveTrigger = $effectiveTrigger->add($duration);
62 $effectiveTrigger = $effectiveTrigger->add($triggerDuration);
64 $effectiveTrigger = $parentComponent->DTSTART->getDateTime();
65 $effectiveTrigger = $effectiveTrigger->add($triggerDuration);
69 $effectiveTrigger = $trigger->getDateTime();
71 return $effectiveTrigger;
91 if (isset($this->DURATION)) {
93 $repeat = (string)$this->REPEAT;
98 $period = new \DatePeriod($effectiveTrigger, $duration, (
int)
$repeat);
100 foreach ($period as $occurrence) {
102 if ($start <= $occurrence && $end > $occurrence) {
108 return ($start <= $effectiveTrigger && $end > $effectiveTrigger);
isInTimeRange(DateTimeInterface $start, DateTimeInterface $end)
Returns true or false depending on if the event falls in the specified time-range.
static parseDuration($duration, $asString=false)
Parses an iCalendar (RFC5545) formatted duration value.
getEffectiveTriggerTime()
Returns a DateTime object when this alarm is going to trigger.
This exception is thrown whenever an invalid value is found anywhere in a iCalendar or vCard object...