aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/vobject
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sabre/vobject')
-rw-r--r--vendor/sabre/vobject/README.md2
-rw-r--r--vendor/sabre/vobject/lib/Cli.php2
-rw-r--r--vendor/sabre/vobject/lib/Component.php1
-rw-r--r--vendor/sabre/vobject/lib/Component/VCard.php1
-rw-r--r--vendor/sabre/vobject/lib/ElementList.php2
-rw-r--r--vendor/sabre/vobject/lib/ITip/Broker.php24
-rw-r--r--vendor/sabre/vobject/lib/Node.php7
-rw-r--r--vendor/sabre/vobject/lib/Parameter.php2
-rw-r--r--vendor/sabre/vobject/lib/Parser/MimeDir.php4
-rw-r--r--vendor/sabre/vobject/lib/Property.php7
-rw-r--r--vendor/sabre/vobject/lib/Property/Binary.php4
-rw-r--r--vendor/sabre/vobject/lib/Property/FloatValue.php2
-rw-r--r--vendor/sabre/vobject/lib/Property/ICalendar/CalAddress.php4
-rw-r--r--vendor/sabre/vobject/lib/Property/ICalendar/DateTime.php1
-rw-r--r--vendor/sabre/vobject/lib/Property/ICalendar/Duration.php2
-rw-r--r--vendor/sabre/vobject/lib/Property/ICalendar/Period.php2
-rw-r--r--vendor/sabre/vobject/lib/Property/Time.php4
-rw-r--r--vendor/sabre/vobject/lib/Property/Uri.php4
-rw-r--r--vendor/sabre/vobject/lib/Property/UtcOffset.php4
-rw-r--r--vendor/sabre/vobject/lib/Property/VCard/DateAndOrTime.php4
-rw-r--r--vendor/sabre/vobject/lib/Property/VCard/TimeStamp.php4
-rw-r--r--vendor/sabre/vobject/lib/Recur/EventIterator.php17
-rw-r--r--vendor/sabre/vobject/lib/Recur/RDateIterator.php9
-rw-r--r--vendor/sabre/vobject/lib/Recur/RRuleIterator.php9
-rw-r--r--vendor/sabre/vobject/lib/TimeZoneUtil.php261
-rw-r--r--vendor/sabre/vobject/lib/Version.php2
26 files changed, 227 insertions, 158 deletions
diff --git a/vendor/sabre/vobject/README.md b/vendor/sabre/vobject/README.md
index 5030cf276..659e3fa83 100644
--- a/vendor/sabre/vobject/README.md
+++ b/vendor/sabre/vobject/README.md
@@ -4,7 +4,7 @@ sabre/vobject
The VObject library allows you to easily parse and manipulate [iCalendar](https://tools.ietf.org/html/rfc5545)
and [vCard](https://tools.ietf.org/html/rfc6350) objects using PHP.
-The goal of the VObject library is to create a very complete library, with an easy to use API.
+The goal of the VObject library is to create a very complete library, with an easy-to-use API.
Installation
diff --git a/vendor/sabre/vobject/lib/Cli.php b/vendor/sabre/vobject/lib/Cli.php
index 4984ac9b2..816e2cb31 100644
--- a/vendor/sabre/vobject/lib/Cli.php
+++ b/vendor/sabre/vobject/lib/Cli.php
@@ -453,8 +453,6 @@ HELP
* Colorizes a file.
*
* @param Component $vObj
- *
- * @return int
*/
protected function color($vObj)
{
diff --git a/vendor/sabre/vobject/lib/Component.php b/vendor/sabre/vobject/lib/Component.php
index 07f6a627f..f33b628a7 100644
--- a/vendor/sabre/vobject/lib/Component.php
+++ b/vendor/sabre/vobject/lib/Component.php
@@ -339,6 +339,7 @@ class Component extends Node
*
* @return array
*/
+ #[\ReturnTypeWillChange]
public function jsonSerialize()
{
$components = [];
diff --git a/vendor/sabre/vobject/lib/Component/VCard.php b/vendor/sabre/vobject/lib/Component/VCard.php
index 2430df621..eac789842 100644
--- a/vendor/sabre/vobject/lib/Component/VCard.php
+++ b/vendor/sabre/vobject/lib/Component/VCard.php
@@ -445,6 +445,7 @@ class VCard extends VObject\Document
*
* @return array
*/
+ #[\ReturnTypeWillChange]
public function jsonSerialize()
{
// A vcard does not have sub-components, so we're overriding this
diff --git a/vendor/sabre/vobject/lib/ElementList.php b/vendor/sabre/vobject/lib/ElementList.php
index 56058cbd5..860512649 100644
--- a/vendor/sabre/vobject/lib/ElementList.php
+++ b/vendor/sabre/vobject/lib/ElementList.php
@@ -25,6 +25,7 @@ class ElementList extends ArrayIterator
* @param int $offset
* @param mixed $value
*/
+ #[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
throw new LogicException('You can not add new objects to an ElementList');
@@ -37,6 +38,7 @@ class ElementList extends ArrayIterator
*
* @param int $offset
*/
+ #[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
throw new LogicException('You can not remove objects from an ElementList');
diff --git a/vendor/sabre/vobject/lib/ITip/Broker.php b/vendor/sabre/vobject/lib/ITip/Broker.php
index 4e0368e13..b66a59f54 100644
--- a/vendor/sabre/vobject/lib/ITip/Broker.php
+++ b/vendor/sabre/vobject/lib/ITip/Broker.php
@@ -547,9 +547,13 @@ class Broker
// properties changed in the event, or simply if there's a
// difference in instances that the attendee is invited to.
+ $oldAttendeeInstances = array_keys($attendee['oldInstances']);
+ $newAttendeeInstances = array_keys($attendee['newInstances']);
+
$message->significantChange =
'REQUEST' === $attendee['forceSend'] ||
- array_keys($attendee['oldInstances']) != array_keys($attendee['newInstances']) ||
+ count($oldAttendeeInstances) != count($newAttendeeInstances) ||
+ count(array_diff($oldAttendeeInstances, $newAttendeeInstances)) > 0 ||
$oldEventInfo['significantChangeHash'] !== $eventInfo['significantChangeHash'];
foreach ($attendee['newInstances'] as $instanceId => $instanceInfo) {
@@ -816,7 +820,10 @@ class Broker
$instances = [];
$exdate = [];
+ $significantChangeEventProperties = [];
+
foreach ($calendar->VEVENT as $vevent) {
+ $eventSignificantChangeHash = '';
$rrule = [];
if (is_null($uid)) {
@@ -930,19 +937,26 @@ class Broker
if (isset($vevent->$prop)) {
$propertyValues = $vevent->select($prop);
- $significantChangeHash .= $prop.':';
+ $eventSignificantChangeHash .= $prop.':';
if ('EXDATE' === $prop) {
- $significantChangeHash .= implode(',', $exdate).';';
+ $eventSignificantChangeHash .= implode(',', $exdate).';';
} elseif ('RRULE' === $prop) {
- $significantChangeHash .= implode(',', $rrule).';';
+ $eventSignificantChangeHash .= implode(',', $rrule).';';
} else {
foreach ($propertyValues as $val) {
- $significantChangeHash .= $val->getValue().';';
+ $eventSignificantChangeHash .= $val->getValue().';';
}
}
}
}
+ $significantChangeEventProperties[] = $eventSignificantChangeHash;
+ }
+
+ asort($significantChangeEventProperties);
+
+ foreach ($significantChangeEventProperties as $eventSignificantChangeHash) {
+ $significantChangeHash .= $eventSignificantChangeHash;
}
$significantChangeHash = md5($significantChangeHash);
diff --git a/vendor/sabre/vobject/lib/Node.php b/vendor/sabre/vobject/lib/Node.php
index 4c0c04f72..2041b2ac7 100644
--- a/vendor/sabre/vobject/lib/Node.php
+++ b/vendor/sabre/vobject/lib/Node.php
@@ -73,6 +73,7 @@ abstract class Node implements \IteratorAggregate, \ArrayAccess, \Countable, \Js
*
* @return array
*/
+ #[\ReturnTypeWillChange]
abstract public function jsonSerialize();
/**
@@ -102,6 +103,7 @@ abstract class Node implements \IteratorAggregate, \ArrayAccess, \Countable, \Js
*
* @return ElementList
*/
+ #[\ReturnTypeWillChange]
public function getIterator()
{
if (!is_null($this->iterator)) {
@@ -157,6 +159,7 @@ abstract class Node implements \IteratorAggregate, \ArrayAccess, \Countable, \Js
*
* @return int
*/
+ #[\ReturnTypeWillChange]
public function count()
{
$it = $this->getIterator();
@@ -177,6 +180,7 @@ abstract class Node implements \IteratorAggregate, \ArrayAccess, \Countable, \Js
*
* @return bool
*/
+ #[\ReturnTypeWillChange]
public function offsetExists($offset)
{
$iterator = $this->getIterator();
@@ -193,6 +197,7 @@ abstract class Node implements \IteratorAggregate, \ArrayAccess, \Countable, \Js
*
* @return mixed
*/
+ #[\ReturnTypeWillChange]
public function offsetGet($offset)
{
$iterator = $this->getIterator();
@@ -208,6 +213,7 @@ abstract class Node implements \IteratorAggregate, \ArrayAccess, \Countable, \Js
* @param int $offset
* @param mixed $value
*/
+ #[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
$iterator = $this->getIterator();
@@ -228,6 +234,7 @@ abstract class Node implements \IteratorAggregate, \ArrayAccess, \Countable, \Js
*
* @param int $offset
*/
+ #[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
$iterator = $this->getIterator();
diff --git a/vendor/sabre/vobject/lib/Parameter.php b/vendor/sabre/vobject/lib/Parameter.php
index 72f2ecbcb..7e4d55743 100644
--- a/vendor/sabre/vobject/lib/Parameter.php
+++ b/vendor/sabre/vobject/lib/Parameter.php
@@ -321,6 +321,7 @@ class Parameter extends Node
*
* @return array
*/
+ #[\ReturnTypeWillChange]
public function jsonSerialize()
{
return $this->value;
@@ -354,6 +355,7 @@ class Parameter extends Node
*
* @return ElementList
*/
+ #[\ReturnTypeWillChange]
public function getIterator()
{
if (!is_null($this->iterator)) {
diff --git a/vendor/sabre/vobject/lib/Parser/MimeDir.php b/vendor/sabre/vobject/lib/Parser/MimeDir.php
index 385d340d7..db0f81531 100644
--- a/vendor/sabre/vobject/lib/Parser/MimeDir.php
+++ b/vendor/sabre/vobject/lib/Parser/MimeDir.php
@@ -439,7 +439,7 @@ class MimeDir extends Parser
$propObj->add(null, $namelessParameter);
}
- if ('QUOTED-PRINTABLE' === strtoupper($propObj['ENCODING'])) {
+ if (isset($propObj['ENCODING']) && 'QUOTED-PRINTABLE' === strtoupper($propObj['ENCODING'])) {
$propObj->setQuotedPrintableValue($this->extractQuotedPrintableValue());
} else {
$charset = $this->charset;
@@ -518,7 +518,7 @@ class MimeDir extends Parser
*
* Now for the parameters
*
- * If delimiter is not set (null) this method will just return a string.
+ * If delimiter is not set (empty string) this method will just return a string.
* If it's a comma or a semi-colon the string will be split on those
* characters, and always return an array.
*
diff --git a/vendor/sabre/vobject/lib/Property.php b/vendor/sabre/vobject/lib/Property.php
index f9cf8e38e..50cda9684 100644
--- a/vendor/sabre/vobject/lib/Property.php
+++ b/vendor/sabre/vobject/lib/Property.php
@@ -52,7 +52,7 @@ abstract class Property extends Node
* In case this is a multi-value property. This string will be used as a
* delimiter.
*
- * @var string|null
+ * @var string
*/
public $delimiter = ';';
@@ -276,6 +276,7 @@ abstract class Property extends Node
*
* @return array
*/
+ #[\ReturnTypeWillChange]
public function jsonSerialize()
{
$parameters = [];
@@ -387,6 +388,7 @@ abstract class Property extends Node
*
* @return bool
*/
+ #[\ReturnTypeWillChange]
public function offsetExists($name)
{
if (is_int($name)) {
@@ -413,6 +415,7 @@ abstract class Property extends Node
*
* @return Node
*/
+ #[\ReturnTypeWillChange]
public function offsetGet($name)
{
if (is_int($name)) {
@@ -433,6 +436,7 @@ abstract class Property extends Node
* @param string $name
* @param mixed $value
*/
+ #[\ReturnTypeWillChange]
public function offsetSet($name, $value)
{
if (is_int($name)) {
@@ -453,6 +457,7 @@ abstract class Property extends Node
*
* @param string $name
*/
+ #[\ReturnTypeWillChange]
public function offsetUnset($name)
{
if (is_int($name)) {
diff --git a/vendor/sabre/vobject/lib/Property/Binary.php b/vendor/sabre/vobject/lib/Property/Binary.php
index ec6713fdd..1262dd054 100644
--- a/vendor/sabre/vobject/lib/Property/Binary.php
+++ b/vendor/sabre/vobject/lib/Property/Binary.php
@@ -24,9 +24,9 @@ class Binary extends Property
* In case this is a multi-value property. This string will be used as a
* delimiter.
*
- * @var string|null
+ * @var string
*/
- public $delimiter = null;
+ public $delimiter = '';
/**
* Updates the current value.
diff --git a/vendor/sabre/vobject/lib/Property/FloatValue.php b/vendor/sabre/vobject/lib/Property/FloatValue.php
index 0d0346968..e780ae6c1 100644
--- a/vendor/sabre/vobject/lib/Property/FloatValue.php
+++ b/vendor/sabre/vobject/lib/Property/FloatValue.php
@@ -21,7 +21,7 @@ class FloatValue extends Property
* In case this is a multi-value property. This string will be used as a
* delimiter.
*
- * @var string|null
+ * @var string
*/
public $delimiter = ';';
diff --git a/vendor/sabre/vobject/lib/Property/ICalendar/CalAddress.php b/vendor/sabre/vobject/lib/Property/ICalendar/CalAddress.php
index 86be66c15..2dbbc6eaf 100644
--- a/vendor/sabre/vobject/lib/Property/ICalendar/CalAddress.php
+++ b/vendor/sabre/vobject/lib/Property/ICalendar/CalAddress.php
@@ -19,9 +19,9 @@ class CalAddress extends Text
* In case this is a multi-value property. This string will be used as a
* delimiter.
*
- * @var string|null
+ * @var string
*/
- public $delimiter = null;
+ public $delimiter = '';
/**
* Returns the type of value.
diff --git a/vendor/sabre/vobject/lib/Property/ICalendar/DateTime.php b/vendor/sabre/vobject/lib/Property/ICalendar/DateTime.php
index d635e17ae..ca71633b9 100644
--- a/vendor/sabre/vobject/lib/Property/ICalendar/DateTime.php
+++ b/vendor/sabre/vobject/lib/Property/ICalendar/DateTime.php
@@ -300,6 +300,7 @@ class DateTime extends Property
* @param string $name
* @param mixed $value
*/
+ #[\ReturnTypeWillChange]
public function offsetSet($name, $value)
{
parent::offsetSet($name, $value);
diff --git a/vendor/sabre/vobject/lib/Property/ICalendar/Duration.php b/vendor/sabre/vobject/lib/Property/ICalendar/Duration.php
index 87f008160..e18fe191e 100644
--- a/vendor/sabre/vobject/lib/Property/ICalendar/Duration.php
+++ b/vendor/sabre/vobject/lib/Property/ICalendar/Duration.php
@@ -22,7 +22,7 @@ class Duration extends Property
* In case this is a multi-value property. This string will be used as a
* delimiter.
*
- * @var string|null
+ * @var string
*/
public $delimiter = ',';
diff --git a/vendor/sabre/vobject/lib/Property/ICalendar/Period.php b/vendor/sabre/vobject/lib/Property/ICalendar/Period.php
index eb3752770..ae8a78911 100644
--- a/vendor/sabre/vobject/lib/Property/ICalendar/Period.php
+++ b/vendor/sabre/vobject/lib/Property/ICalendar/Period.php
@@ -23,7 +23,7 @@ class Period extends Property
* In case this is a multi-value property. This string will be used as a
* delimiter.
*
- * @var string|null
+ * @var string
*/
public $delimiter = ',';
diff --git a/vendor/sabre/vobject/lib/Property/Time.php b/vendor/sabre/vobject/lib/Property/Time.php
index 544b5ced3..1b81609aa 100644
--- a/vendor/sabre/vobject/lib/Property/Time.php
+++ b/vendor/sabre/vobject/lib/Property/Time.php
@@ -19,9 +19,9 @@ class Time extends Text
* In case this is a multi-value property. This string will be used as a
* delimiter.
*
- * @var string|null
+ * @var string
*/
- public $delimiter = null;
+ public $delimiter = '';
/**
* Returns the type of value.
diff --git a/vendor/sabre/vobject/lib/Property/Uri.php b/vendor/sabre/vobject/lib/Property/Uri.php
index 830cd3f18..1ad1fb199 100644
--- a/vendor/sabre/vobject/lib/Property/Uri.php
+++ b/vendor/sabre/vobject/lib/Property/Uri.php
@@ -20,9 +20,9 @@ class Uri extends Text
* In case this is a multi-value property. This string will be used as a
* delimiter.
*
- * @var string|null
+ * @var string
*/
- public $delimiter = null;
+ public $delimiter = '';
/**
* Returns the type of value.
diff --git a/vendor/sabre/vobject/lib/Property/UtcOffset.php b/vendor/sabre/vobject/lib/Property/UtcOffset.php
index 248ed40ea..04b88447f 100644
--- a/vendor/sabre/vobject/lib/Property/UtcOffset.php
+++ b/vendor/sabre/vobject/lib/Property/UtcOffset.php
@@ -17,9 +17,9 @@ class UtcOffset extends Text
* In case this is a multi-value property. This string will be used as a
* delimiter.
*
- * @var string|null
+ * @var string
*/
- public $delimiter = null;
+ public $delimiter = '';
/**
* Returns the type of value.
diff --git a/vendor/sabre/vobject/lib/Property/VCard/DateAndOrTime.php b/vendor/sabre/vobject/lib/Property/VCard/DateAndOrTime.php
index 09918b31a..7bf79c48c 100644
--- a/vendor/sabre/vobject/lib/Property/VCard/DateAndOrTime.php
+++ b/vendor/sabre/vobject/lib/Property/VCard/DateAndOrTime.php
@@ -24,9 +24,9 @@ class DateAndOrTime extends Property
/**
* Field separator.
*
- * @var string|null
+ * @var string
*/
- public $delimiter = null;
+ public $delimiter = '';
/**
* Returns the type of value.
diff --git a/vendor/sabre/vobject/lib/Property/VCard/TimeStamp.php b/vendor/sabre/vobject/lib/Property/VCard/TimeStamp.php
index fccf2d600..da6ea3d44 100644
--- a/vendor/sabre/vobject/lib/Property/VCard/TimeStamp.php
+++ b/vendor/sabre/vobject/lib/Property/VCard/TimeStamp.php
@@ -21,9 +21,9 @@ class TimeStamp extends Text
* In case this is a multi-value property. This string will be used as a
* delimiter.
*
- * @var string|null
+ * @var string
*/
- public $delimiter = null;
+ public $delimiter = '';
/**
* Returns the type of value.
diff --git a/vendor/sabre/vobject/lib/Recur/EventIterator.php b/vendor/sabre/vobject/lib/Recur/EventIterator.php
index e42ca1360..61f05d7de 100644
--- a/vendor/sabre/vobject/lib/Recur/EventIterator.php
+++ b/vendor/sabre/vobject/lib/Recur/EventIterator.php
@@ -198,6 +198,7 @@ class EventIterator implements \Iterator
*
* @return DateTimeImmutable
*/
+ #[\ReturnTypeWillChange]
public function current()
{
if ($this->currentDate) {
@@ -229,9 +230,13 @@ class EventIterator implements \Iterator
if (!$this->valid()) {
return;
}
- $end = clone $this->currentDate;
+ if ($this->currentOverriddenEvent && $this->currentOverriddenEvent->DTEND) {
+ return $this->currentOverriddenEvent->DTEND->getDateTime($this->timeZone);
+ } else {
+ $end = clone $this->currentDate;
- return $end->modify('+'.$this->eventDuration.' seconds');
+ return $end->modify('+'.$this->eventDuration.' seconds');
+ }
}
/**
@@ -281,6 +286,7 @@ class EventIterator implements \Iterator
*
* @return int
*/
+ #[\ReturnTypeWillChange]
public function key()
{
// The counter is always 1 ahead.
@@ -293,6 +299,7 @@ class EventIterator implements \Iterator
*
* @return bool
*/
+ #[\ReturnTypeWillChange]
public function valid()
{
if ($this->counter > Settings::$maxRecurrences && -1 !== Settings::$maxRecurrences) {
@@ -304,7 +311,10 @@ class EventIterator implements \Iterator
/**
* Sets the iterator back to the starting point.
+ *
+ * @return void
*/
+ #[\ReturnTypeWillChange]
public function rewind()
{
$this->recurIterator->rewind();
@@ -327,7 +337,10 @@ class EventIterator implements \Iterator
/**
* Advances the iterator with one step.
+ *
+ * @return void
*/
+ #[\ReturnTypeWillChange]
public function next()
{
$this->currentOverriddenEvent = null;
diff --git a/vendor/sabre/vobject/lib/Recur/RDateIterator.php b/vendor/sabre/vobject/lib/Recur/RDateIterator.php
index d117e152c..5d56657fa 100644
--- a/vendor/sabre/vobject/lib/Recur/RDateIterator.php
+++ b/vendor/sabre/vobject/lib/Recur/RDateIterator.php
@@ -35,6 +35,7 @@ class RDateIterator implements Iterator
/* Implementation of the Iterator interface {{{ */
+ #[\ReturnTypeWillChange]
public function current()
{
if (!$this->valid()) {
@@ -49,6 +50,7 @@ class RDateIterator implements Iterator
*
* @return int
*/
+ #[\ReturnTypeWillChange]
public function key()
{
return $this->counter;
@@ -60,6 +62,7 @@ class RDateIterator implements Iterator
*
* @return bool
*/
+ #[\ReturnTypeWillChange]
public function valid()
{
return $this->counter <= count($this->dates);
@@ -67,7 +70,10 @@ class RDateIterator implements Iterator
/**
* Resets the iterator.
+ *
+ * @return void
*/
+ #[\ReturnTypeWillChange]
public function rewind()
{
$this->currentDate = clone $this->startDate;
@@ -76,7 +82,10 @@ class RDateIterator implements Iterator
/**
* Goes on to the next iteration.
+ *
+ * @return void
*/
+ #[\ReturnTypeWillChange]
public function next()
{
++$this->counter;
diff --git a/vendor/sabre/vobject/lib/Recur/RRuleIterator.php b/vendor/sabre/vobject/lib/Recur/RRuleIterator.php
index 0511f0ade..d556aa6c3 100644
--- a/vendor/sabre/vobject/lib/Recur/RRuleIterator.php
+++ b/vendor/sabre/vobject/lib/Recur/RRuleIterator.php
@@ -38,6 +38,7 @@ class RRuleIterator implements Iterator
/* Implementation of the Iterator interface {{{ */
+ #[\ReturnTypeWillChange]
public function current()
{
if (!$this->valid()) {
@@ -52,6 +53,7 @@ class RRuleIterator implements Iterator
*
* @return int
*/
+ #[\ReturnTypeWillChange]
public function key()
{
return $this->counter;
@@ -64,6 +66,7 @@ class RRuleIterator implements Iterator
*
* @return bool
*/
+ #[\ReturnTypeWillChange]
public function valid()
{
if (null === $this->currentDate) {
@@ -78,7 +81,10 @@ class RRuleIterator implements Iterator
/**
* Resets the iterator.
+ *
+ * @return void
*/
+ #[\ReturnTypeWillChange]
public function rewind()
{
$this->currentDate = clone $this->startDate;
@@ -87,7 +93,10 @@ class RRuleIterator implements Iterator
/**
* Goes on to the next iteration.
+ *
+ * @return void
*/
+ #[\ReturnTypeWillChange]
public function next()
{
// Otherwise, we find the next event in the normal RRULE
diff --git a/vendor/sabre/vobject/lib/TimeZoneUtil.php b/vendor/sabre/vobject/lib/TimeZoneUtil.php
index 2c407fee6..6422c0930 100644
--- a/vendor/sabre/vobject/lib/TimeZoneUtil.php
+++ b/vendor/sabre/vobject/lib/TimeZoneUtil.php
@@ -2,6 +2,16 @@
namespace Sabre\VObject;
+use DateTimeZone;
+use InvalidArgumentException;
+use Sabre\VObject\TimezoneGuesser\FindFromOffset;
+use Sabre\VObject\TimezoneGuesser\FindFromTimezoneIdentifier;
+use Sabre\VObject\TimezoneGuesser\FindFromTimezoneMap;
+use Sabre\VObject\TimezoneGuesser\GuessFromLicEntry;
+use Sabre\VObject\TimezoneGuesser\GuessFromMsTzId;
+use Sabre\VObject\TimezoneGuesser\TimezoneFinder;
+use Sabre\VObject\TimezoneGuesser\TimezoneGuesser;
+
/**
* Time zone name translation.
*
@@ -14,17 +24,136 @@ namespace Sabre\VObject;
*/
class TimeZoneUtil
{
+ /** @var self */
+ private static $instance = null;
+
+ /** @var TimezoneGuesser[] */
+ private $timezoneGuessers = [];
+
+ /** @var TimezoneFinder[] */
+ private $timezoneFinders = [];
+
+ private function __construct()
+ {
+ $this->addGuesser('lic', new GuessFromLicEntry());
+ $this->addGuesser('msTzId', new GuessFromMsTzId());
+ $this->addFinder('tzid', new FindFromTimezoneIdentifier());
+ $this->addFinder('tzmap', new FindFromTimezoneMap());
+ $this->addFinder('offset', new FindFromOffset());
+ }
+
+ private static function getInstance(): self
+ {
+ if (null === self::$instance) {
+ self::$instance = new self();
+ }
+
+ return self::$instance;
+ }
+
+ private function addGuesser(string $key, TimezoneGuesser $guesser): void
+ {
+ $this->timezoneGuessers[$key] = $guesser;
+ }
+
+ private function addFinder(string $key, TimezoneFinder $finder): void
+ {
+ $this->timezoneFinders[$key] = $finder;
+ }
+
+ /**
+ * This method will try to find out the correct timezone for an iCalendar
+ * date-time value.
+ *
+ * You must pass the contents of the TZID parameter, as well as the full
+ * calendar.
+ *
+ * If the lookup fails, this method will return the default PHP timezone
+ * (as configured using date_default_timezone_set, or the date.timezone ini
+ * setting).
+ *
+ * Alternatively, if $failIfUncertain is set to true, it will throw an
+ * exception if we cannot accurately determine the timezone.
+ */
+ private function findTimeZone(string $tzid, Component $vcalendar = null, bool $failIfUncertain = false): DateTimeZone
+ {
+ foreach ($this->timezoneFinders as $timezoneFinder) {
+ $timezone = $timezoneFinder->find($tzid, $failIfUncertain);
+ if (!$timezone instanceof DateTimeZone) {
+ continue;
+ }
+
+ return $timezone;
+ }
+
+ if ($vcalendar) {
+ // If that didn't work, we will scan VTIMEZONE objects
+ foreach ($vcalendar->select('VTIMEZONE') as $vtimezone) {
+ if ((string) $vtimezone->TZID === $tzid) {
+ foreach ($this->timezoneGuessers as $timezoneGuesser) {
+ $timezone = $timezoneGuesser->guess($vtimezone, $failIfUncertain);
+ if (!$timezone instanceof DateTimeZone) {
+ continue;
+ }
+
+ return $timezone;
+ }
+ }
+ }
+ }
+
+ if ($failIfUncertain) {
+ throw new InvalidArgumentException('We were unable to determine the correct PHP timezone for tzid: '.$tzid);
+ }
+
+ // If we got all the way here, we default to whatever has been set as the PHP default timezone.
+ return new DateTimeZone(date_default_timezone_get());
+ }
+
+ public static function addTimezoneGuesser(string $key, TimezoneGuesser $guesser): void
+ {
+ self::getInstance()->addGuesser($key, $guesser);
+ }
+
+ public static function addTimezoneFinder(string $key, TimezoneFinder $finder): void
+ {
+ self::getInstance()->addFinder($key, $finder);
+ }
+
+ /**
+ * @param string $tzid
+ * @param false $failIfUncertain
+ *
+ * @return DateTimeZone
+ */
+ public static function getTimeZone($tzid, Component $vcalendar = null, $failIfUncertain = false)
+ {
+ return self::getInstance()->findTimeZone($tzid, $vcalendar, $failIfUncertain);
+ }
+
+ public static function clean(): void
+ {
+ self::$instance = null;
+ }
+
+ // Keeping things for backwards compatibility
+ /**
+ * @var array|null
+ *
+ * @deprecated
+ */
public static $map = null;
/**
* List of microsoft exchange timezone ids.
*
* Source: http://msdn.microsoft.com/en-us/library/aa563018(loband).aspx
+ *
+ * @deprecated
*/
public static $microsoftExchangeMap = [
0 => 'UTC',
31 => 'Africa/Casablanca',
-
// Insanely, id #2 is used for both Europe/Lisbon, and Europe/Sarajevo.
// I'm not even kidding.. We handle this special case in the
// getTimeZone method.
@@ -104,134 +233,10 @@ class TimeZoneUtil
];
/**
- * This method will try to find out the correct timezone for an iCalendar
- * date-time value.
- *
- * You must pass the contents of the TZID parameter, as well as the full
- * calendar.
- *
- * If the lookup fails, this method will return the default PHP timezone
- * (as configured using date_default_timezone_set, or the date.timezone ini
- * setting).
- *
- * Alternatively, if $failIfUncertain is set to true, it will throw an
- * exception if we cannot accurately determine the timezone.
- *
- * @param string $tzid
- * @param Sabre\VObject\Component $vcalendar
- *
- * @return \DateTimeZone
- */
- public static function getTimeZone($tzid, Component $vcalendar = null, $failIfUncertain = false)
- {
- // First we will just see if the tzid is a support timezone identifier.
- //
- // The only exception is if the timezone starts with (. This is to
- // handle cases where certain microsoft products generate timezone
- // identifiers that for instance look like:
- //
- // (GMT+01.00) Sarajevo/Warsaw/Zagreb
- //
- // Since PHP 5.5.10, the first bit will be used as the timezone and
- // this method will return just GMT+01:00. This is wrong, because it
- // doesn't take DST into account.
- if ('(' !== $tzid[0]) {
- // PHP has a bug that logs PHP warnings even it shouldn't:
- // https://bugs.php.net/bug.php?id=67881
- //
- // That's why we're checking if we'll be able to successfully instantiate
- // \DateTimeZone() before doing so. Otherwise we could simply instantiate
- // and catch the exception.
- $tzIdentifiers = \DateTimeZone::listIdentifiers();
-
- try {
- if (
- (in_array($tzid, $tzIdentifiers)) ||
- (preg_match('/^GMT(\+|-)([0-9]{4})$/', $tzid, $matches)) ||
- (in_array($tzid, self::getIdentifiersBC()))
- ) {
- return new \DateTimeZone($tzid);
- }
- } catch (\Exception $e) {
- }
- }
-
- self::loadTzMaps();
-
- // Next, we check if the tzid is somewhere in our tzid map.
- if (isset(self::$map[$tzid])) {
- return new \DateTimeZone(self::$map[$tzid]);
- }
-
- // Some Microsoft products prefix the offset first, so let's strip that off
- // and see if it is our tzid map. We don't want to check for this first just
- // in case there are overrides in our tzid map.
- if (preg_match('/^\((UTC|GMT)(\+|\-)[\d]{2}\:[\d]{2}\) (.*)/', $tzid, $matches)) {
- $tzidAlternate = $matches[3];
- if (isset(self::$map[$tzidAlternate])) {
- return new \DateTimeZone(self::$map[$tzidAlternate]);
- }
- }
-
- // Maybe the author was hyper-lazy and just included an offset. We
- // support it, but we aren't happy about it.
- if (preg_match('/^GMT(\+|-)([0-9]{4})$/', $tzid, $matches)) {
- // Note that the path in the source will never be taken from PHP 5.5.10
- // onwards. PHP 5.5.10 supports the "GMT+0100" style of format, so it
- // already gets returned early in this function. Once we drop support
- // for versions under PHP 5.5.10, this bit can be taken out of the
- // source.
- // @codeCoverageIgnoreStart
- return new \DateTimeZone('Etc/GMT'.$matches[1].ltrim(substr($matches[2], 0, 2), '0'));
- // @codeCoverageIgnoreEnd
- }
-
- if ($vcalendar) {
- // If that didn't work, we will scan VTIMEZONE objects
- foreach ($vcalendar->select('VTIMEZONE') as $vtimezone) {
- if ((string) $vtimezone->TZID === $tzid) {
- // Some clients add 'X-LIC-LOCATION' with the olson name.
- if (isset($vtimezone->{'X-LIC-LOCATION'})) {
- $lic = (string) $vtimezone->{'X-LIC-LOCATION'};
-
- // Libical generators may specify strings like
- // "SystemV/EST5EDT". For those we must remove the
- // SystemV part.
- if ('SystemV/' === substr($lic, 0, 8)) {
- $lic = substr($lic, 8);
- }
-
- return self::getTimeZone($lic, null, $failIfUncertain);
- }
- // Microsoft may add a magic number, which we also have an
- // answer for.
- if (isset($vtimezone->{'X-MICROSOFT-CDO-TZID'})) {
- $cdoId = (int) $vtimezone->{'X-MICROSOFT-CDO-TZID'}->getValue();
-
- // 2 can mean both Europe/Lisbon and Europe/Sarajevo.
- if (2 === $cdoId && false !== strpos((string) $vtimezone->TZID, 'Sarajevo')) {
- return new \DateTimeZone('Europe/Sarajevo');
- }
-
- if (isset(self::$microsoftExchangeMap[$cdoId])) {
- return new \DateTimeZone(self::$microsoftExchangeMap[$cdoId]);
- }
- }
- }
- }
- }
-
- if ($failIfUncertain) {
- throw new \InvalidArgumentException('We were unable to determine the correct PHP timezone for tzid: '.$tzid);
- }
-
- // If we got all the way here, we default to UTC.
- return new \DateTimeZone(date_default_timezone_get());
- }
-
- /**
* This method will load in all the tz mapping information, if it's not yet
* done.
+ *
+ * @deprecated
*/
public static function loadTzMaps()
{
@@ -257,6 +262,8 @@ class TimeZoneUtil
* (See timezonedata/php-bc.php and timezonedata php-workaround.php)
*
* @return array
+ *
+ * @deprecated
*/
public static function getIdentifiersBC()
{
diff --git a/vendor/sabre/vobject/lib/Version.php b/vendor/sabre/vobject/lib/Version.php
index 63452400f..64938bf0b 100644
--- a/vendor/sabre/vobject/lib/Version.php
+++ b/vendor/sabre/vobject/lib/Version.php
@@ -14,5 +14,5 @@ class Version
/**
* Full version number.
*/
- const VERSION = '4.3.5';
+ const VERSION = '4.4.1';
}