aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/vobject/lib/Component/VAlarm.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2019-04-25 21:49:18 -0700
committerzotlabs <mike@macgirvin.com>2019-04-25 21:49:18 -0700
commite6521d1cf3166a888ad58b09059d9dc5746ad795 (patch)
tree6ab3e41d888f18b2dcad351f86c3ed0628eda307 /vendor/sabre/vobject/lib/Component/VAlarm.php
parent96785e8df1b325a32c93ebebf67ab5208f4088dc (diff)
parentd689778465c0439d0ceae071dab2509e3f95403e (diff)
downloadvolse-hubzilla-e6521d1cf3166a888ad58b09059d9dc5746ad795.tar.gz
volse-hubzilla-e6521d1cf3166a888ad58b09059d9dc5746ad795.tar.bz2
volse-hubzilla-e6521d1cf3166a888ad58b09059d9dc5746ad795.zip
Merge branch 'dev' of https://framagit.org/hubzilla/core into dev
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' => '?',
];
-
}
-
}