From 5468de2c6ad5187cd51201cda929c3e54cc2938f Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 11 Feb 2022 09:23:29 +0000 Subject: composer libs minor version updates add new files --- vendor/sabre/dav/.github/workflows/ci.yml | 127 +++++++++++++++++++++ .../dav/lib/DAV/Auth/Backend/PDOBasicAuth.php | 114 ++++++++++++++++++ vendor/sabre/event/.github/workflows/ci.yml | 63 ++++++++++ vendor/sabre/http/.github/workflows/ci.yml | 64 +++++++++++ vendor/sabre/uri/.github/workflows/ci.yml | 63 ++++++++++ vendor/sabre/vobject/.github/workflows/ci.yml | 63 ++++++++++ .../vobject/lib/TimezoneGuesser/FindFromOffset.php | 31 +++++ .../TimezoneGuesser/FindFromTimezoneIdentifier.php | 71 ++++++++++++ .../lib/TimezoneGuesser/FindFromTimezoneMap.php | 78 +++++++++++++ .../lib/TimezoneGuesser/GuessFromLicEntry.php | 33 ++++++ .../lib/TimezoneGuesser/GuessFromMsTzId.php | 119 +++++++++++++++++++ .../vobject/lib/TimezoneGuesser/TimezoneFinder.php | 10 ++ .../lib/TimezoneGuesser/TimezoneGuesser.php | 11 ++ vendor/sabre/xml/.github/workflows/ci.yml | 63 ++++++++++ 14 files changed, 910 insertions(+) create mode 100644 vendor/sabre/dav/.github/workflows/ci.yml create mode 100644 vendor/sabre/dav/lib/DAV/Auth/Backend/PDOBasicAuth.php create mode 100644 vendor/sabre/event/.github/workflows/ci.yml create mode 100644 vendor/sabre/http/.github/workflows/ci.yml create mode 100644 vendor/sabre/uri/.github/workflows/ci.yml create mode 100644 vendor/sabre/vobject/.github/workflows/ci.yml create mode 100644 vendor/sabre/vobject/lib/TimezoneGuesser/FindFromOffset.php create mode 100644 vendor/sabre/vobject/lib/TimezoneGuesser/FindFromTimezoneIdentifier.php create mode 100644 vendor/sabre/vobject/lib/TimezoneGuesser/FindFromTimezoneMap.php create mode 100644 vendor/sabre/vobject/lib/TimezoneGuesser/GuessFromLicEntry.php create mode 100644 vendor/sabre/vobject/lib/TimezoneGuesser/GuessFromMsTzId.php create mode 100644 vendor/sabre/vobject/lib/TimezoneGuesser/TimezoneFinder.php create mode 100644 vendor/sabre/vobject/lib/TimezoneGuesser/TimezoneGuesser.php create mode 100644 vendor/sabre/xml/.github/workflows/ci.yml (limited to 'vendor/sabre') diff --git a/vendor/sabre/dav/.github/workflows/ci.yml b/vendor/sabre/dav/.github/workflows/ci.yml new file mode 100644 index 000000000..f41b38535 --- /dev/null +++ b/vendor/sabre/dav/.github/workflows/ci.yml @@ -0,0 +1,127 @@ +name: continuous-integration +on: + push: + branches: + - master + - release/* + pull_request: + +jobs: + code-analysis: + runs-on: ubuntu-latest + name: Code Analysis (PHP ${{ matrix.php-versions }}) + strategy: + fail-fast: false + matrix: + php-versions: [ '7.4' ] + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP, with composer and extensions + uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php + with: + php-version: ${{ matrix.php-versions }} + extensions: mbstring, dom, fileinfo, mysql, redis, opcache + tools: composer + + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache composer dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + # Use composer.json for key, if composer.lock is not committed. + # key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install Composer dependencies + run: composer install --no-progress --prefer-dist --optimize-autoloader + + - name: PHP CS-Fixer + run: php vendor/bin/php-cs-fixer fix --dry-run --diff + + - name: PHPStan + run: composer phpstan + + unit-testing: + name: PHPUnit (PHP ${{ matrix.php-versions }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php-versions: [ '7.1', '7.2', '7.3', '7.4', '8.0' ] + coverage: [ 'none' ] + streaming: [ false ] + include: + - php-versions: '8.1' + coverage: 'pcov' + streaming: true + + services: + mariadb: + image: mariadb + env: + MARIADB_DATABASE: 'sabredav_test' + MARIADB_ROOT_PASSWORD: root + ports: + - 3306:3306 + postgres: + image: postgres + env: + POSTGRES_DB: 'sabredav_test' + POSTGRES_PASSWORD: postgres + ports: + - 5432:5432 + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP, with composer and extensions + uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php + with: + php-version: ${{ matrix.php-versions }} + extensions: mbstring, dom, fileinfo, pdo_sqlite, pgsql, mysql, redis, opcache + coverage: ${{ matrix.coverage }} + tools: composer + + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache composer dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + # Use composer.json for key, if composer.lock is not committed. + # key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install Composer dependencies + run: composer install --no-progress --prefer-dist --optimize-autoloader + + - name: PHPUnit + if: matrix.streaming == false + run: vendor/bin/phpunit --verbose --configuration tests/phpunit.xml --coverage-clover=coverage.xml + env: + SABRE_MYSQLUSER: root + SABRE_MYSQLPASS: root + SABRE_MYSQLDSN: "mysql:host=127.0.0.1;port=3306;dbname=sabredav_test" + SABRE_PGSQLDSN: "pgsql:host=127.0.0.1;port=5432;dbname=sabredav_test;user=postgres;password=postgres" + + - name: PHPUnit (with streaming) + if: matrix.streaming == true + run: vendor/bin/phpunit --verbose --configuration tests/phpunit.xml --coverage-clover=coverage.xml + env: + SABRE_MYSQLUSER: root + SABRE_MYSQLPASS: root + SABRE_MYSQLDSN: "mysql:host=127.0.0.1;port=3306;dbname=sabredav_test" + SABRE_PGSQLDSN: "pgsql:host=127.0.0.1;port=5432;dbname=sabredav_test;user=postgres;password=postgres" + RUN_TEST_WITH_STREAMING_PROPFIND: "true" + + - uses: codecov/codecov-action@v2 + if: matrix.coverage != 'none' diff --git a/vendor/sabre/dav/lib/DAV/Auth/Backend/PDOBasicAuth.php b/vendor/sabre/dav/lib/DAV/Auth/Backend/PDOBasicAuth.php new file mode 100644 index 000000000..39324e4db --- /dev/null +++ b/vendor/sabre/dav/lib/DAV/Auth/Backend/PDOBasicAuth.php @@ -0,0 +1,114 @@ +pdo = $pdo; + if (isset($options['tableName'])) { + $this->tableName = $options['tableName']; + } else { + $this->tableName = 'users'; + } + if (isset($options['digestColumn'])) { + $this->digestColumn = $options['digestColumn']; + } else { + $this->digestColumn = 'digest'; + } + if (isset($options['uuidColumn'])) { + $this->uuidColumn = $options['uuidColumn']; + } else { + $this->uuidColumn = 'username'; + } + if (isset($options['digestPrefix'])) { + $this->digestPrefix = $options['digestPrefix']; + } + } + + /** + * Validates a username and password. + * + * This method should return true or false depending on if login + * succeeded. + * + * @param string $username + * @param string $password + * + * @return bool + */ + public function validateUserPass($username, $password) + { + $stmt = $this->pdo->prepare('SELECT '.$this->digestColumn.' FROM '.$this->tableName.' WHERE '.$this->uuidColumn.' = ?'); + $stmt->execute([$username]); + $result = $stmt->fetchAll(); + + if (!count($result)) { + return false; + } else { + $digest = $result[0][$this->digestColumn]; + + if (isset($this->digestPrefix)) { + $digest = substr($digest, strlen($this->digestPrefix)); + } + + if (password_verify($password, $digest)) { + return true; + } + + return false; + } + } +} diff --git a/vendor/sabre/event/.github/workflows/ci.yml b/vendor/sabre/event/.github/workflows/ci.yml new file mode 100644 index 000000000..3473cd2de --- /dev/null +++ b/vendor/sabre/event/.github/workflows/ci.yml @@ -0,0 +1,63 @@ +name: continuous-integration +on: + push: + branches: + - master + - release/* + pull_request: +jobs: + unit-testing: + name: PHPUnit (PHP ${{ matrix.php-versions }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1'] + coverage: ['pcov'] + code-analysis: ['no'] + include: + - php-versions: '7.1' + coverage: 'none' + code-analysis: 'yes' + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP, with composer and extensions + uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php + with: + php-version: ${{ matrix.php-versions }} + extensions: mbstring, dom, fileinfo, mysql, redis, opcache + coverage: ${{ matrix.coverage }} + tools: composer + + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache composer dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + # Use composer.json for key, if composer.lock is not committed. + # key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install composer dependencies + run: composer install --no-progress --prefer-dist --optimize-autoloader + + - name: Code Analysis (PHP CS-Fixer) + if: matrix.code-analysis == 'yes' + run: php vendor/bin/php-cs-fixer fix --dry-run --diff + + - name: Code Analysis (PHPStan) + if: matrix.code-analysis == 'yes' + run: composer phpstan + + - name: Test with phpunit + run: vendor/bin/phpunit --configuration tests/phpunit.xml --coverage-clover clover.xml + + - name: Code Coverage + uses: codecov/codecov-action@v2 + if: matrix.coverage != 'none' diff --git a/vendor/sabre/http/.github/workflows/ci.yml b/vendor/sabre/http/.github/workflows/ci.yml new file mode 100644 index 000000000..91b509bf0 --- /dev/null +++ b/vendor/sabre/http/.github/workflows/ci.yml @@ -0,0 +1,64 @@ +name: continuous-integration +on: + push: + branches: + - master + - release/* + pull_request: +jobs: + unit-testing: + name: PHPUnit (PHP ${{ matrix.php-versions }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1'] + coverage: ['pcov'] + code-analysis: ['no'] + include: + - php-versions: '7.1' + coverage: 'none' + code-analysis: 'yes' + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP, with composer and extensions + uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php + with: + php-version: ${{ matrix.php-versions }} + extensions: ctype, curl, mbstring + coverage: ${{ matrix.coverage }} + tools: composer + + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache composer dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install composer dependencies + run: composer install --no-progress --prefer-dist --optimize-autoloader + + - name: Code Analysis (PHP CS-Fixer) + if: matrix.code-analysis == 'yes' + run: php vendor/bin/php-cs-fixer fix --dry-run --diff + + - name: Code Analysis (PHPStan) + if: matrix.code-analysis == 'yes' + run: composer phpstan + + - name: Run application server + run: php -S localhost:8000 -t tests/www 2>/dev/null & + + - name: Test with phpunit + run: vendor/bin/phpunit --configuration tests/phpunit.xml --coverage-clover clover.xml + + - name: Code Coverage + uses: codecov/codecov-action@v2 + if: matrix.coverage != 'none' diff --git a/vendor/sabre/uri/.github/workflows/ci.yml b/vendor/sabre/uri/.github/workflows/ci.yml new file mode 100644 index 000000000..3473cd2de --- /dev/null +++ b/vendor/sabre/uri/.github/workflows/ci.yml @@ -0,0 +1,63 @@ +name: continuous-integration +on: + push: + branches: + - master + - release/* + pull_request: +jobs: + unit-testing: + name: PHPUnit (PHP ${{ matrix.php-versions }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1'] + coverage: ['pcov'] + code-analysis: ['no'] + include: + - php-versions: '7.1' + coverage: 'none' + code-analysis: 'yes' + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP, with composer and extensions + uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php + with: + php-version: ${{ matrix.php-versions }} + extensions: mbstring, dom, fileinfo, mysql, redis, opcache + coverage: ${{ matrix.coverage }} + tools: composer + + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache composer dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + # Use composer.json for key, if composer.lock is not committed. + # key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install composer dependencies + run: composer install --no-progress --prefer-dist --optimize-autoloader + + - name: Code Analysis (PHP CS-Fixer) + if: matrix.code-analysis == 'yes' + run: php vendor/bin/php-cs-fixer fix --dry-run --diff + + - name: Code Analysis (PHPStan) + if: matrix.code-analysis == 'yes' + run: composer phpstan + + - name: Test with phpunit + run: vendor/bin/phpunit --configuration tests/phpunit.xml --coverage-clover clover.xml + + - name: Code Coverage + uses: codecov/codecov-action@v2 + if: matrix.coverage != 'none' diff --git a/vendor/sabre/vobject/.github/workflows/ci.yml b/vendor/sabre/vobject/.github/workflows/ci.yml new file mode 100644 index 000000000..3a019fe77 --- /dev/null +++ b/vendor/sabre/vobject/.github/workflows/ci.yml @@ -0,0 +1,63 @@ +name: continuous-integration +on: + push: + branches: + - master + - release/* + pull_request: +jobs: + unit-testing: + name: PHPUnit (PHP ${{ matrix.php-versions }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1'] + coverage: ['pcov'] + code-analysis: ['no'] + include: + - php-versions: '7.1' + coverage: 'none' + code-analysis: 'yes' + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP, with composer and extensions + uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php + with: + php-version: ${{ matrix.php-versions }} + extensions: mbstring, dom, fileinfo, mysql, redis, opcache + coverage: ${{ matrix.coverage }} + tools: composer + + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache composer dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + # Use composer.json for key, if composer.lock is not committed. + # key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install composer dependencies + run: composer install --no-progress --prefer-dist --optimize-autoloader + + - name: Code Analysis (PHP CS-Fixer) + if: matrix.code-analysis == 'yes' + run: php vendor/bin/php-cs-fixer fix --dry-run --diff + + - name: Code Analysis (PHPStan) + if: matrix.code-analysis == 'yes' + run: composer phpstan + + - name: Test with phpunit + run: vendor/bin/phpunit --configuration tests/phpunit.xml --coverage-clover clover.xml + + - name: Code Coverage + uses: codecov/codecov-action@v2 + if: matrix.coverage != 'none' 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 @@ +getIdentifiersBC())) + ) { + return new DateTimeZone($tzid); + } + } catch (Exception $e) { + } + + return null; + } + + /** + * This method returns an array of timezone identifiers, that are supported + * by DateTimeZone(), but not returned by DateTimeZone::listIdentifiers(). + * + * We're not using DateTimeZone::listIdentifiers(DateTimeZone::ALL_WITH_BC) because: + * - It's not supported by some PHP versions as well as HHVM. + * - It also returns identifiers, that are invalid values for new DateTimeZone() on some PHP versions. + * (See timezonedata/php-bc.php and timezonedata php-workaround.php) + * + * @return array + */ + private function getIdentifiersBC() + { + return include __DIR__.'/../timezonedata/php-bc.php'; + } +} diff --git a/vendor/sabre/vobject/lib/TimezoneGuesser/FindFromTimezoneMap.php b/vendor/sabre/vobject/lib/TimezoneGuesser/FindFromTimezoneMap.php new file mode 100644 index 000000000..b52ba6a19 --- /dev/null +++ b/vendor/sabre/vobject/lib/TimezoneGuesser/FindFromTimezoneMap.php @@ -0,0 +1,78 @@ +hasTzInMap($tzid)) { + return new DateTimeZone($this->getTzFromMap($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. + foreach ($this->patterns as $pattern) { + if (!preg_match($pattern, $tzid, $matches)) { + continue; + } + $tzidAlternate = $matches[3]; + if ($this->hasTzInMap($tzidAlternate)) { + return new DateTimeZone($this->getTzFromMap($tzidAlternate)); + } + } + + return null; + } + + /** + * This method returns an array of timezone identifiers, that are supported + * by DateTimeZone(), but not returned by DateTimeZone::listIdentifiers(). + * + * We're not using DateTimeZone::listIdentifiers(DateTimeZone::ALL_WITH_BC) because: + * - It's not supported by some PHP versions as well as HHVM. + * - It also returns identifiers, that are invalid values for new DateTimeZone() on some PHP versions. + * (See timezonedata/php-bc.php and timezonedata php-workaround.php) + * + * @return array + */ + private function getTzMaps() + { + if ([] === $this->map) { + $this->map = array_merge( + include __DIR__.'/../timezonedata/windowszones.php', + include __DIR__.'/../timezonedata/lotuszones.php', + include __DIR__.'/../timezonedata/exchangezones.php', + include __DIR__.'/../timezonedata/php-workaround.php' + ); + } + + return $this->map; + } + + private function getTzFromMap(string $tzid): string + { + return $this->getTzMaps()[$tzid]; + } + + private function hasTzInMap(string $tzid): bool + { + return isset($this->getTzMaps()[$tzid]); + } +} diff --git a/vendor/sabre/vobject/lib/TimezoneGuesser/GuessFromLicEntry.php b/vendor/sabre/vobject/lib/TimezoneGuesser/GuessFromLicEntry.php new file mode 100644 index 000000000..f340a3962 --- /dev/null +++ b/vendor/sabre/vobject/lib/TimezoneGuesser/GuessFromLicEntry.php @@ -0,0 +1,33 @@ +{'X-LIC-LOCATION'})) { + return null; + } + + $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 TimeZoneUtil::getTimeZone($lic, null, $failIfUncertain); + } +} diff --git a/vendor/sabre/vobject/lib/TimezoneGuesser/GuessFromMsTzId.php b/vendor/sabre/vobject/lib/TimezoneGuesser/GuessFromMsTzId.php new file mode 100644 index 000000000..b11ce1832 --- /dev/null +++ b/vendor/sabre/vobject/lib/TimezoneGuesser/GuessFromMsTzId.php @@ -0,0 +1,119 @@ + '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', + 69 => 'Africa/Luanda', // This was a best guess + 7 => 'Europe/Athens', + 5 => 'Europe/Bucharest', + 49 => 'Africa/Cairo', + 50 => 'Africa/Harare', + 59 => 'Europe/Helsinki', + 27 => 'Asia/Jerusalem', + 26 => 'Asia/Baghdad', + 74 => 'Asia/Kuwait', + 51 => 'Europe/Moscow', + 56 => 'Africa/Nairobi', + 25 => 'Asia/Tehran', + 24 => 'Asia/Muscat', // Best guess + 54 => 'Asia/Baku', + 48 => 'Asia/Kabul', + 58 => 'Asia/Yekaterinburg', + 47 => 'Asia/Karachi', + 23 => 'Asia/Calcutta', + 62 => 'Asia/Kathmandu', + 46 => 'Asia/Almaty', + 71 => 'Asia/Dhaka', + 66 => 'Asia/Colombo', + 61 => 'Asia/Rangoon', + 22 => 'Asia/Bangkok', + 64 => 'Asia/Krasnoyarsk', + 45 => 'Asia/Shanghai', + 63 => 'Asia/Irkutsk', + 21 => 'Asia/Singapore', + 73 => 'Australia/Perth', + 75 => 'Asia/Taipei', + 20 => 'Asia/Tokyo', + 72 => 'Asia/Seoul', + 70 => 'Asia/Yakutsk', + 19 => 'Australia/Adelaide', + 44 => 'Australia/Darwin', + 18 => 'Australia/Brisbane', + 76 => 'Australia/Sydney', + 43 => 'Pacific/Guam', + 42 => 'Australia/Hobart', + 68 => 'Asia/Vladivostok', + 41 => 'Asia/Magadan', + 17 => 'Pacific/Auckland', + 40 => 'Pacific/Fiji', + 67 => 'Pacific/Tongatapu', + 29 => 'Atlantic/Azores', + 53 => 'Atlantic/Cape_Verde', + 30 => 'America/Noronha', + 8 => 'America/Sao_Paulo', // Best guess + 32 => 'America/Argentina/Buenos_Aires', + 60 => 'America/Godthab', + 28 => 'America/St_Johns', + 9 => 'America/Halifax', + 33 => 'America/Caracas', + 65 => 'America/Santiago', + 35 => 'America/Bogota', + 10 => 'America/New_York', + 34 => 'America/Indiana/Indianapolis', + 55 => 'America/Guatemala', + 11 => 'America/Chicago', + 37 => 'America/Mexico_City', + 36 => 'America/Edmonton', + 38 => 'America/Phoenix', + 12 => 'America/Denver', // Best guess + 13 => 'America/Los_Angeles', // Best guess + 14 => 'America/Anchorage', + 15 => 'Pacific/Honolulu', + 16 => 'Pacific/Midway', + 39 => 'Pacific/Kwajalein', + ]; + + public function guess(VTimeZone $vtimezone, bool $throwIfUnsure = false): ?DateTimeZone + { + // Microsoft may add a magic number, which we also have an + // answer for. + if (!isset($vtimezone->{'X-MICROSOFT-CDO-TZID'})) { + return null; + } + $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]); + } + + return null; + } +} diff --git a/vendor/sabre/vobject/lib/TimezoneGuesser/TimezoneFinder.php b/vendor/sabre/vobject/lib/TimezoneGuesser/TimezoneFinder.php new file mode 100644 index 000000000..5aa880a1c --- /dev/null +++ b/vendor/sabre/vobject/lib/TimezoneGuesser/TimezoneFinder.php @@ -0,0 +1,10 @@ +