diff options
author | Mario Vavti <mario@mariovavti.com> | 2022-03-29 11:42:53 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2022-03-29 11:42:53 +0200 |
commit | 0784cd593a39a4fc297e8a82f7e79bc8019a0868 (patch) | |
tree | 22182afb37cf460f8208fff9d276a0672add3185 /vendor/sabre/vobject/lib/TimezoneGuesser/FindFromOffset.php | |
parent | 0e2e9321025f87fe9587f3d183adaea6185e4e20 (diff) | |
parent | 9c5d2ee5630dd7033904039dcd1e92db8821b644 (diff) | |
download | volse-hubzilla-0784cd593a39a4fc297e8a82f7e79bc8019a0868.tar.gz volse-hubzilla-0784cd593a39a4fc297e8a82f7e79bc8019a0868.tar.bz2 volse-hubzilla-0784cd593a39a4fc297e8a82f7e79bc8019a0868.zip |
Merge branch '7.2RC'7.2
Diffstat (limited to 'vendor/sabre/vobject/lib/TimezoneGuesser/FindFromOffset.php')
-rw-r--r-- | vendor/sabre/vobject/lib/TimezoneGuesser/FindFromOffset.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/vendor/sabre/vobject/lib/TimezoneGuesser/FindFromOffset.php b/vendor/sabre/vobject/lib/TimezoneGuesser/FindFromOffset.php new file mode 100644 index 000000000..990ac9692 --- /dev/null +++ b/vendor/sabre/vobject/lib/TimezoneGuesser/FindFromOffset.php @@ -0,0 +1,31 @@ +<?php + +declare(strict_types=1); + +namespace Sabre\VObject\TimezoneGuesser; + +use DateTimeZone; + +/** + * Some clients add 'X-LIC-LOCATION' with the olson name. + */ +class FindFromOffset implements TimezoneFinder +{ + public function find(string $tzid, bool $failIfUncertain = false): ?DateTimeZone + { + // 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 + } + + return null; + } +} |