mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-11-02 18:38:48 +03:00
Sabre/VObject 4.5.4 for #1311
This commit is contained in:
parent
90a657c0fb
commit
70a2ebb671
75 changed files with 1213 additions and 1944 deletions
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Sabre\VObject\Component;
|
||||
|
||||
use DateTimeInterface;
|
||||
use Sabre\VObject;
|
||||
|
||||
/**
|
||||
|
|
@ -13,6 +12,19 @@ use Sabre\VObject;
|
|||
* @copyright Copyright (C) fruux GmbH (https://fruux.com/)
|
||||
* @author Evert Pot (http://evertpot.com/)
|
||||
* @license http://sabre.io/license/ Modified BSD License
|
||||
*
|
||||
* @property VObject\Property\ICalendar\DateTime DTSTART
|
||||
* @property VObject\Property\ICalendar\DateTime DTEND
|
||||
* @property VObject\Property\ICalendar\DateTime DTSTAMP
|
||||
* @property VObject\Property\ICalendar\Duration DURATION
|
||||
* @property VObject\Property\ICalendar\Recur RRULE
|
||||
* @property VObject\Property\ICalendar\DateTime EXDATE
|
||||
* @property VObject\Property\ICalendar\DateTime RDATE
|
||||
* @property VObject\Property\ICalendar\Recur EXRULE
|
||||
* @property VObject\Property\ICalendar\DateTime {'RECURRENCE-ID'}
|
||||
* @property VObject\Property\ICalendar\DateTime DUE
|
||||
* @property VObject\Property\ICalendar\DateTime COMPLETED
|
||||
* @property VObject\Property\ICalendar\DateTime CREATED
|
||||
*/
|
||||
class VTodo extends VObject\Component
|
||||
{
|
||||
|
|
@ -23,9 +35,9 @@ class VTodo extends VObject\Component
|
|||
* The rules used to determine if an event falls within the specified
|
||||
* time-range is based on the CalDAV specification.
|
||||
*
|
||||
* @return bool
|
||||
* @throws VObject\InvalidDataException
|
||||
*/
|
||||
public function isInTimeRange(DateTimeInterface $start, DateTimeInterface $end)
|
||||
public function isInTimeRange(\DateTimeInterface $start, \DateTimeInterface $end): bool
|
||||
{
|
||||
$dtstart = isset($this->DTSTART) ? $this->DTSTART->getDateTime() : null;
|
||||
$duration = isset($this->DURATION) ? VObject\DateTimeParser::parseDuration($this->DURATION) : null;
|
||||
|
|
@ -40,8 +52,8 @@ class VTodo extends VObject\Component
|
|||
return $start <= $effectiveEnd && $end > $dtstart;
|
||||
} elseif ($due) {
|
||||
return
|
||||
($start < $due || $start <= $dtstart) &&
|
||||
($end > $dtstart || $end >= $due);
|
||||
($start < $due || $start <= $dtstart)
|
||||
&& ($end > $dtstart || $end >= $due);
|
||||
} else {
|
||||
return $start <= $dtstart && $end > $dtstart;
|
||||
}
|
||||
|
|
@ -51,8 +63,8 @@ class VTodo extends VObject\Component
|
|||
}
|
||||
if ($completed && $created) {
|
||||
return
|
||||
($start <= $created || $start <= $completed) &&
|
||||
($end >= $created || $end >= $completed);
|
||||
($start <= $created || $start <= $completed)
|
||||
&& ($end >= $created || $end >= $completed);
|
||||
}
|
||||
if ($completed) {
|
||||
return $start <= $completed && $end >= $completed;
|
||||
|
|
@ -76,10 +88,8 @@ class VTodo extends VObject\Component
|
|||
* * + - Must appear at least once.
|
||||
* * * - Can appear any number of times.
|
||||
* * ? - May appear, but not more than once.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public function getValidationRules()
|
||||
public function getValidationRules(): array
|
||||
{
|
||||
return [
|
||||
'UID' => 1,
|
||||
|
|
@ -137,11 +147,9 @@ class VTodo extends VObject\Component
|
|||
* 2 - An inconsequential issue
|
||||
* 3 - A severe issue.
|
||||
*
|
||||
* @param int $options
|
||||
*
|
||||
* @return array
|
||||
* @throws VObject\InvalidDataException
|
||||
*/
|
||||
public function validate($options = 0)
|
||||
public function validate(int $options = 0): array
|
||||
{
|
||||
$result = parent::validate($options);
|
||||
if (isset($this->DUE) && isset($this->DTSTART)) {
|
||||
|
|
@ -168,10 +176,8 @@ class VTodo extends VObject\Component
|
|||
|
||||
/**
|
||||
* This method should return a list of default property values.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getDefaults()
|
||||
protected function getDefaults(): array
|
||||
{
|
||||
return [
|
||||
'UID' => 'sabre-vobject-'.VObject\UUIDUtil::getUUID(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue