aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/vobject/lib/Component/VAlarm.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sabre/vobject/lib/Component/VAlarm.php')
-rw-r--r--vendor/sabre/vobject/lib/Component/VAlarm.php46
1 files changed, 25 insertions, 21 deletions
diff --git a/vendor/sabre/vobject/lib/Component/VAlarm.php b/vendor/sabre/vobject/lib/Component/VAlarm.php
index bd00eb600..faa8a5e74 100644
--- a/vendor/sabre/vobject/lib/Component/VAlarm.php
+++ b/vendor/sabre/vobject/lib/Component/VAlarm.php
@@ -16,8 +16,8 @@ use Sabre\VObject\InvalidDataException;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class VAlarm extends VObject\Component
-{
+class VAlarm extends VObject\Component {
+
/**
* Returns a DateTime object when this alarm is going to trigger.
*
@@ -25,16 +25,17 @@ class VAlarm extends VObject\Component
*
* @return DateTimeImmutable
*/
- public function getEffectiveTriggerTime()
- {
+ function getEffectiveTriggerTime() {
+
$trigger = $this->TRIGGER;
- if (!isset($trigger['VALUE']) || 'DURATION' === strtoupper($trigger['VALUE'])) {
+ if (!isset($trigger['VALUE']) || strtoupper($trigger['VALUE']) === 'DURATION') {
$triggerDuration = VObject\DateTimeParser::parseDuration($this->TRIGGER);
- $related = (isset($trigger['RELATED']) && 'END' == strtoupper($trigger['RELATED'])) ? 'END' : 'START';
+ $related = (isset($trigger['RELATED']) && strtoupper($trigger['RELATED']) == 'END') ? 'END' : 'START';
$parentComponent = $this->parent;
- if ('START' === $related) {
- if ('VTODO' === $parentComponent->name) {
+ if ($related === 'START') {
+
+ if ($parentComponent->name === 'VTODO') {
$propName = 'DUE';
} else {
$propName = 'DTSTART';
@@ -43,9 +44,9 @@ class VAlarm extends VObject\Component
$effectiveTrigger = $parentComponent->$propName->getDateTime();
$effectiveTrigger = $effectiveTrigger->add($triggerDuration);
} else {
- if ('VTODO' === $parentComponent->name) {
+ if ($parentComponent->name === 'VTODO') {
$endProp = 'DUE';
- } elseif ('VEVENT' === $parentComponent->name) {
+ } elseif ($parentComponent->name === 'VEVENT') {
$endProp = 'DTEND';
} else {
throw new InvalidDataException('time-range filters on VALARM components are only supported when they are a child of VTODO or VEVENT');
@@ -67,8 +68,8 @@ class VAlarm extends VObject\Component
} else {
$effectiveTrigger = $trigger->getDateTime();
}
-
return $effectiveTrigger;
+
}
/**
@@ -83,29 +84,30 @@ class VAlarm extends VObject\Component
*
* @return bool
*/
- public function isInTimeRange(DateTimeInterface $start, DateTimeInterface $end)
- {
+ function isInTimeRange(DateTimeInterface $start, DateTimeInterface $end) {
+
$effectiveTrigger = $this->getEffectiveTriggerTime();
if (isset($this->DURATION)) {
$duration = VObject\DateTimeParser::parseDuration($this->DURATION);
- $repeat = (string) $this->REPEAT;
+ $repeat = (string)$this->REPEAT;
if (!$repeat) {
$repeat = 1;
}
- $period = new \DatePeriod($effectiveTrigger, $duration, (int) $repeat);
+ $period = new \DatePeriod($effectiveTrigger, $duration, (int)$repeat);
foreach ($period as $occurrence) {
+
if ($start <= $occurrence && $end > $occurrence) {
return true;
}
}
-
return false;
} else {
- return $start <= $effectiveTrigger && $end > $effectiveTrigger;
+ return ($start <= $effectiveTrigger && $end > $effectiveTrigger);
}
+
}
/**
@@ -123,16 +125,18 @@ class VAlarm extends VObject\Component
*
* @var array
*/
- public function getValidationRules()
- {
+ function getValidationRules() {
+
return [
- 'ACTION' => 1,
+ 'ACTION' => 1,
'TRIGGER' => 1,
'DURATION' => '?',
- 'REPEAT' => '?',
+ 'REPEAT' => '?',
'ATTACH' => '?',
];
+
}
+
}