aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/vobject/lib/Component/VAlarm.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2019-04-25 08:52:50 +0200
committerMario Vavti <mario@mariovavti.com>2019-04-25 08:52:50 +0200
commite779335d060b3a51d6a144d23af4097ae6801473 (patch)
tree2427765313f715a0e5b48228abe5200cb82b787f /vendor/sabre/vobject/lib/Component/VAlarm.php
parente937e8fff96a935b14a479c062f6b0d00b90b99d (diff)
downloadvolse-hubzilla-e779335d060b3a51d6a144d23af4097ae6801473.tar.gz
volse-hubzilla-e779335d060b3a51d6a144d23af4097ae6801473.tar.bz2
volse-hubzilla-e779335d060b3a51d6a144d23af4097ae6801473.zip
update composer libs
Diffstat (limited to 'vendor/sabre/vobject/lib/Component/VAlarm.php')
-rw-r--r--vendor/sabre/vobject/lib/Component/VAlarm.php46
1 files changed, 21 insertions, 25 deletions
diff --git a/vendor/sabre/vobject/lib/Component/VAlarm.php b/vendor/sabre/vobject/lib/Component/VAlarm.php
index faa8a5e74..bd00eb600 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,17 +25,16 @@ class VAlarm extends VObject\Component {
*
* @return DateTimeImmutable
*/
- function getEffectiveTriggerTime() {
-
+ public function getEffectiveTriggerTime()
+ {
$trigger = $this->TRIGGER;
- if (!isset($trigger['VALUE']) || strtoupper($trigger['VALUE']) === 'DURATION') {
+ if (!isset($trigger['VALUE']) || 'DURATION' === strtoupper($trigger['VALUE'])) {
$triggerDuration = VObject\DateTimeParser::parseDuration($this->TRIGGER);
- $related = (isset($trigger['RELATED']) && strtoupper($trigger['RELATED']) == 'END') ? 'END' : 'START';
+ $related = (isset($trigger['RELATED']) && 'END' == strtoupper($trigger['RELATED'])) ? 'END' : 'START';
$parentComponent = $this->parent;
- if ($related === 'START') {
-
- if ($parentComponent->name === 'VTODO') {
+ if ('START' === $related) {
+ if ('VTODO' === $parentComponent->name) {
$propName = 'DUE';
} else {
$propName = 'DTSTART';
@@ -44,9 +43,9 @@ class VAlarm extends VObject\Component {
$effectiveTrigger = $parentComponent->$propName->getDateTime();
$effectiveTrigger = $effectiveTrigger->add($triggerDuration);
} else {
- if ($parentComponent->name === 'VTODO') {
+ if ('VTODO' === $parentComponent->name) {
$endProp = 'DUE';
- } elseif ($parentComponent->name === 'VEVENT') {
+ } elseif ('VEVENT' === $parentComponent->name) {
$endProp = 'DTEND';
} else {
throw new InvalidDataException('time-range filters on VALARM components are only supported when they are a child of VTODO or VEVENT');
@@ -68,8 +67,8 @@ class VAlarm extends VObject\Component {
} else {
$effectiveTrigger = $trigger->getDateTime();
}
- return $effectiveTrigger;
+ return $effectiveTrigger;
}
/**
@@ -84,30 +83,29 @@ class VAlarm extends VObject\Component {
*
* @return bool
*/
- function isInTimeRange(DateTimeInterface $start, DateTimeInterface $end) {
-
+ public 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;
}
-
}
/**
@@ -125,18 +123,16 @@ class VAlarm extends VObject\Component {
*
* @var array
*/
- function getValidationRules() {
-
+ public function getValidationRules()
+ {
return [
- 'ACTION' => 1,
+ 'ACTION' => 1,
'TRIGGER' => 1,
'DURATION' => '?',
- 'REPEAT' => '?',
+ 'REPEAT' => '?',
'ATTACH' => '?',
];
-
}
-
}