aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/vobject/lib/Component/VTodo.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2019-04-25 11:47:18 +0200
committerMario Vavti <mario@mariovavti.com>2019-04-25 11:47:18 +0200
commita60c2f38c689f254bd8bb8e7ea9af78bf21c1f84 (patch)
tree65d1d73918ccb1d4ccc36184d70af2e8dd91f28e /vendor/sabre/vobject/lib/Component/VTodo.php
parentf1c07977809ce3221286d53e99f0d91145b1166f (diff)
downloadvolse-hubzilla-a60c2f38c689f254bd8bb8e7ea9af78bf21c1f84.tar.gz
volse-hubzilla-a60c2f38c689f254bd8bb8e7ea9af78bf21c1f84.tar.bz2
volse-hubzilla-a60c2f38c689f254bd8bb8e7ea9af78bf21c1f84.zip
update sabre/vobject
Diffstat (limited to 'vendor/sabre/vobject/lib/Component/VTodo.php')
-rw-r--r--vendor/sabre/vobject/lib/Component/VTodo.php101
1 files changed, 46 insertions, 55 deletions
diff --git a/vendor/sabre/vobject/lib/Component/VTodo.php b/vendor/sabre/vobject/lib/Component/VTodo.php
index 144ced694..9de77e841 100644
--- a/vendor/sabre/vobject/lib/Component/VTodo.php
+++ b/vendor/sabre/vobject/lib/Component/VTodo.php
@@ -14,8 +14,8 @@ use Sabre\VObject;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class VTodo extends VObject\Component {
-
+class VTodo extends VObject\Component
+{
/**
* Returns true or false depending on if the event falls in the specified
* time-range. This is used for filtering purposes.
@@ -28,8 +28,8 @@ class VTodo extends VObject\Component {
*
* @return bool
*/
- function isInTimeRange(DateTimeInterface $start, DateTimeInterface $end) {
-
+ public function isInTimeRange(DateTimeInterface $start, DateTimeInterface $end)
+ {
$dtstart = isset($this->DTSTART) ? $this->DTSTART->getDateTime() : null;
$duration = isset($this->DURATION) ? VObject\DateTimeParser::parseDuration($this->DURATION) : null;
$due = isset($this->DUE) ? $this->DUE->getDateTime() : null;
@@ -39,6 +39,7 @@ class VTodo extends VObject\Component {
if ($dtstart) {
if ($duration) {
$effectiveEnd = $dtstart->add($duration);
+
return $start <= $effectiveEnd && $end > $dtstart;
} elseif ($due) {
return
@@ -49,7 +50,7 @@ class VTodo extends VObject\Component {
}
}
if ($due) {
- return ($start < $due && $end >= $due);
+ return $start < $due && $end >= $due;
}
if ($completed && $created) {
return
@@ -57,13 +58,13 @@ class VTodo extends VObject\Component {
($end >= $created || $end >= $completed);
}
if ($completed) {
- return ($start <= $completed && $end >= $completed);
+ return $start <= $completed && $end >= $completed;
}
if ($created) {
- return ($end > $created);
+ return $end > $created;
}
- return true;
+ return true;
}
/**
@@ -81,45 +82,44 @@ class VTodo extends VObject\Component {
*
* @var array
*/
- function getValidationRules() {
-
+ public function getValidationRules()
+ {
return [
- 'UID' => 1,
+ 'UID' => 1,
'DTSTAMP' => 1,
- 'CLASS' => '?',
- 'COMPLETED' => '?',
- 'CREATED' => '?',
- 'DESCRIPTION' => '?',
- 'DTSTART' => '?',
- 'GEO' => '?',
+ 'CLASS' => '?',
+ 'COMPLETED' => '?',
+ 'CREATED' => '?',
+ 'DESCRIPTION' => '?',
+ 'DTSTART' => '?',
+ 'GEO' => '?',
'LAST-MODIFIED' => '?',
- 'LOCATION' => '?',
- 'ORGANIZER' => '?',
- 'PERCENT' => '?',
- 'PRIORITY' => '?',
+ 'LOCATION' => '?',
+ 'ORGANIZER' => '?',
+ 'PERCENT' => '?',
+ 'PRIORITY' => '?',
'RECURRENCE-ID' => '?',
- 'SEQUENCE' => '?',
- 'STATUS' => '?',
- 'SUMMARY' => '?',
- 'URL' => '?',
+ 'SEQUENCE' => '?',
+ 'STATUS' => '?',
+ 'SUMMARY' => '?',
+ 'URL' => '?',
- 'RRULE' => '?',
- 'DUE' => '?',
+ 'RRULE' => '?',
+ 'DUE' => '?',
'DURATION' => '?',
- 'ATTACH' => '*',
- 'ATTENDEE' => '*',
- 'CATEGORIES' => '*',
- 'COMMENT' => '*',
- 'CONTACT' => '*',
- 'EXDATE' => '*',
+ 'ATTACH' => '*',
+ 'ATTENDEE' => '*',
+ 'CATEGORIES' => '*',
+ 'COMMENT' => '*',
+ 'CONTACT' => '*',
+ 'EXDATE' => '*',
'REQUEST-STATUS' => '*',
- 'RELATED-TO' => '*',
- 'RESOURCES' => '*',
- 'RDATE' => '*',
+ 'RELATED-TO' => '*',
+ 'RESOURCES' => '*',
+ 'RDATE' => '*',
];
-
}
/**
@@ -144,36 +144,29 @@ class VTodo extends VObject\Component {
*
* @return array
*/
- function validate($options = 0) {
-
+ public function validate($options = 0)
+ {
$result = parent::validate($options);
if (isset($this->DUE) && isset($this->DTSTART)) {
-
$due = $this->DUE;
$dtStart = $this->DTSTART;
if ($due->getValueType() !== $dtStart->getValueType()) {
-
$result[] = [
- 'level' => 3,
+ 'level' => 3,
'message' => 'The value type (DATE or DATE-TIME) must be identical for DUE and DTSTART',
- 'node' => $due,
+ 'node' => $due,
];
-
} elseif ($due->getDateTime() < $dtStart->getDateTime()) {
-
$result[] = [
- 'level' => 3,
+ 'level' => 3,
'message' => 'DUE must occur after DTSTART',
- 'node' => $due,
+ 'node' => $due,
];
-
}
-
}
return $result;
-
}
/**
@@ -181,13 +174,11 @@ class VTodo extends VObject\Component {
*
* @return array
*/
- protected function getDefaults() {
-
+ protected function getDefaults()
+ {
return [
- 'UID' => 'sabre-vobject-' . VObject\UUIDUtil::getUUID(),
+ 'UID' => 'sabre-vobject-'.VObject\UUIDUtil::getUUID(),
'DTSTAMP' => date('Ymd\\THis\\Z'),
];
-
}
-
}