aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/vobject/lib/TimeZoneUtil.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2019-04-25 11:24:09 +0200
committerMario <mario@mariovavti.com>2019-04-25 11:24:09 +0200
commitf1c07977809ce3221286d53e99f0d91145b1166f (patch)
tree4c067a3b701ea56f10070c386b26a30f93666eb0 /vendor/sabre/vobject/lib/TimeZoneUtil.php
parent701167bc125700efb3e6ce759b85bcb4d36ee42e (diff)
downloadvolse-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/TimeZoneUtil.php')
-rw-r--r--vendor/sabre/vobject/lib/TimeZoneUtil.php83
1 files changed, 47 insertions, 36 deletions
diff --git a/vendor/sabre/vobject/lib/TimeZoneUtil.php b/vendor/sabre/vobject/lib/TimeZoneUtil.php
index 5b1a775c2..925183e8d 100644
--- a/vendor/sabre/vobject/lib/TimeZoneUtil.php
+++ b/vendor/sabre/vobject/lib/TimeZoneUtil.php
@@ -12,30 +12,30 @@ namespace Sabre\VObject;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class TimeZoneUtil
-{
- public static $map = null;
+class TimeZoneUtil {
+
+ static $map = null;
/**
* List of microsoft exchange timezone ids.
*
* Source: http://msdn.microsoft.com/en-us/library/aa563018(loband).aspx
*/
- public static $microsoftExchangeMap = [
- 0 => 'UTC',
+ 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.
- 2 => 'Europe/Lisbon',
- 1 => 'Europe/London',
- 4 => 'Europe/Berlin',
- 6 => 'Europe/Prague',
- 3 => 'Europe/Paris',
+ 2 => 'Europe/Lisbon',
+ 1 => 'Europe/London',
+ 4 => 'Europe/Berlin',
+ 6 => 'Europe/Prague',
+ 3 => 'Europe/Paris',
69 => 'Africa/Luanda', // This was a best guess
- 7 => 'Europe/Athens',
- 5 => 'Europe/Bucharest',
+ 7 => 'Europe/Athens',
+ 5 => 'Europe/Bucharest',
49 => 'Africa/Cairo',
50 => 'Africa/Harare',
59 => 'Europe/Helsinki',
@@ -117,13 +117,13 @@ class TimeZoneUtil
* Alternatively, if $failIfUncertain is set to true, it will throw an
* exception if we cannot accurately determine the timezone.
*
- * @param string $tzid
+ * @param string $tzid
* @param Sabre\VObject\Component $vcalendar
*
- * @return \DateTimeZone
+ * @return DateTimeZone
*/
- public static function getTimeZone($tzid, Component $vcalendar = null, $failIfUncertain = false)
- {
+ 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
@@ -135,7 +135,8 @@ class TimeZoneUtil
// 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]) {
+ if ($tzid[0] !== '(') {
+
// PHP has a bug that logs PHP warnings even it shouldn't:
// https://bugs.php.net/bug.php?id=67881
//
@@ -154,6 +155,7 @@ class TimeZoneUtil
}
} catch (\Exception $e) {
}
+
}
self::loadTzMaps();
@@ -176,40 +178,46 @@ class TimeZoneUtil
// 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'));
+ 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) {
+
+ 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'};
+
+ $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)) {
+ if (substr($lic, 0, 8) === 'SystemV/') {
$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();
+ $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')) {
+ if ($cdoId === 2 && strpos((string)$vtimezone->TZID, 'Sarajevo') !== false) {
return new \DateTimeZone('Europe/Sarajevo');
}
@@ -217,34 +225,37 @@ class TimeZoneUtil
return new \DateTimeZone(self::$microsoftExchangeMap[$cdoId]);
}
}
+
}
+
}
+
}
if ($failIfUncertain) {
- throw new \InvalidArgumentException('We were unable to determine the correct PHP timezone for tzid: '.$tzid);
+ 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.
*/
- public static function loadTzMaps()
- {
- if (!is_null(self::$map)) {
- return;
- }
+ static function loadTzMaps() {
+
+ if (!is_null(self::$map)) return;
self::$map = array_merge(
- include __DIR__.'/timezonedata/windowszones.php',
- include __DIR__.'/timezonedata/lotuszones.php',
- include __DIR__.'/timezonedata/exchangezones.php',
- include __DIR__.'/timezonedata/php-workaround.php'
+ include __DIR__ . '/timezonedata/windowszones.php',
+ include __DIR__ . '/timezonedata/lotuszones.php',
+ include __DIR__ . '/timezonedata/exchangezones.php',
+ include __DIR__ . '/timezonedata/php-workaround.php'
);
+
}
/**
@@ -258,8 +269,8 @@ class TimeZoneUtil
*
* @return array
*/
- public static function getIdentifiersBC()
- {
- return include __DIR__.'/timezonedata/php-bc.php';
+ static function getIdentifiersBC() {
+ return include __DIR__ . '/timezonedata/php-bc.php';
}
+
}