diff options
author | Mario <mario@mariovavti.com> | 2019-04-25 11:24:09 +0200 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2019-04-25 11:24:09 +0200 |
commit | f1c07977809ce3221286d53e99f0d91145b1166f (patch) | |
tree | 4c067a3b701ea56f10070c386b26a30f93666eb0 /vendor/sabre/vobject/lib/Component/VAlarm.php | |
parent | 701167bc125700efb3e6ce759b85bcb4d36ee42e (diff) | |
download | volse-hubzilla-f1c07977809ce3221286d53e99f0d91145b1166f.tar.gz volse-hubzilla-f1c07977809ce3221286d53e99f0d91145b1166f.tar.bz2 volse-hubzilla-f1c07977809ce3221286d53e99f0d91145b1166f.zip |
Revert "update composer libs"
This reverts commit e779335d060b3a51d6a144d23af4097ae6801473
Diffstat (limited to 'vendor/sabre/vobject/lib/Component/VAlarm.php')
-rw-r--r-- | vendor/sabre/vobject/lib/Component/VAlarm.php | 46 |
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' => '?', ]; + } + } |