From ccf7557a44ac80386dbe56ba9dfc0d2fc5d1f48c Mon Sep 17 00:00:00 2001 From: Bruno Meilick Date: Wed, 2 Aug 2023 11:29:59 +0100 Subject: [PATCH] :arrow_up: upgraded dependencies Signed-off-by: bnomei --- composer.json | 2 +- composer.lock | 377 ++-- vendor/composer/autoload_classmap.php | 2 - vendor/composer/autoload_static.php | 2 - vendor/composer/installed.php | 14 +- vendor/kigkonsult/icalcreator/autoload.php | 4 +- .../icalcreator/src/CalendarComponent.php | 2 - .../src/Formatter/Property/Rdate.php | 6 +- .../src/Formatter/Property/Xproperty.php | 4 +- .../kigkonsult/icalcreator/src/IcalBase.php | 31 +- .../src/Parser/ComponentParser.php | 14 +- .../icalcreator/src/Parser/ParserBase.php | 36 +- .../src/Parser/VcalendarParser.php | 1 - vendor/kigkonsult/icalcreator/src/Pc.php | 14 +- .../icalcreator/src/Traits/CALSCALEtrait.php | 2 +- .../icalcreator/src/Traits/EXRULEtrait.php | 6 +- .../icalcreator/src/Traits/FREEBUSYtrait.php | 3 +- .../icalcreator/src/Traits/ORGANIZERtrait.php | 15 +- .../Traits/Participants2AttendeesTrait.php | 2 +- .../src/Util/CalAddressFactory.php | 60 +- .../src/Util/DateIntervalFactory.php | 27 +- .../icalcreator/src/Util/DateTimeFactory.php | 10 +- .../src/Util/DateTimeZoneFactory.php | 36 +- .../icalcreator/src/Util/IcalXMLFactory.php | 1547 ----------------- .../icalcreator/src/Util/RecurFactory.php | 11 +- .../icalcreator/src/Util/RecurFactory2.php | 106 +- .../src/Util/RegulateTimezoneFactory.php | 918 ---------- .../icalcreator/src/Util/RexdateFactory.php | 12 +- .../icalcreator/src/Util/SelectFactory.php | 70 +- .../icalcreator/src/Util/SortFactory.php | 14 +- .../icalcreator/src/Util/StringFactory.php | 11 +- .../kigkonsult/icalcreator/src/Util/Util.php | 9 +- .../icalcreator/src/Util/UtilDateTime.php | 6 +- .../src/Util/VtimezonePopulateFactory.php | 12 +- .../kigkonsult/icalcreator/src/Vcalendar.php | 25 +- .../icalcreator/src/Xml/Formatter.php | 2 +- 36 files changed, 450 insertions(+), 2963 deletions(-) delete mode 100644 vendor/kigkonsult/icalcreator/src/Util/IcalXMLFactory.php delete mode 100644 vendor/kigkonsult/icalcreator/src/Util/RegulateTimezoneFactory.php diff --git a/composer.json b/composer.json index 058bcbe..7e7b63e 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "bnomei/kirby3-ics", "description": "Generate ICS Files", "type": "kirby-plugin", - "version": "1.0.6", + "version": "1.0.7", "license": "MIT", "authors": [ { diff --git a/composer.lock b/composer.lock index cc41ecd..7f7a0d5 100644 --- a/composer.lock +++ b/composer.lock @@ -55,16 +55,16 @@ }, { "name": "kigkonsult/icalcreator", - "version": "v2.41.74", + "version": "v2.41.80", "source": { "type": "git", "url": "https://github.com/iCalcreator/iCalcreator.git", - "reference": "35b57afc03c07ff8e213ebda7c50f37f70d54526" + "reference": "a15c9b48caa2b50e077f5a9595f889c965d58667" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/iCalcreator/iCalcreator/zipball/35b57afc03c07ff8e213ebda7c50f37f70d54526", - "reference": "35b57afc03c07ff8e213ebda7c50f37f70d54526", + "url": "https://api.github.com/repos/iCalcreator/iCalcreator/zipball/a15c9b48caa2b50e077f5a9595f889c965d58667", + "reference": "a15c9b48caa2b50e077f5a9595f889c965d58667", "shasum": "" }, "require": { @@ -79,9 +79,11 @@ "degraciamathieu/php-arguments-detector": ">=0.5.0", "ext-xdebug": "*", "phpcompatibility/php-compatibility": ">=9.3.5", + "phpmd/phpmd": ">=2.13.0", "phpstan/phpstan": ">=0.9.3", "phpunit/phpunit": ">=6.5.13", - "squizlabs/php_codesniffer": ">=3.5.5" + "squizlabs/php_codesniffer": ">=3.5.5", + "vimeo/psalm": "*" }, "type": "library", "autoload": { @@ -143,7 +145,7 @@ ], "support": { "issues": "https://github.com/iCalcreator/iCalcreator/issues", - "source": "https://github.com/iCalcreator/iCalcreator/tree/v2.41.74" + "source": "https://github.com/iCalcreator/iCalcreator/tree/v2.41.80" }, "funding": [ { @@ -155,22 +157,22 @@ "type": "other" } ], - "time": "2023-03-23T15:48:43+00:00" + "time": "2023-06-28T17:15:11+00:00" } ], "packages-dev": [ { "name": "claviska/simpleimage", - "version": "4.0.2", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/claviska/SimpleImage.git", - "reference": "226d507cca0c8400d69bee7eb324158e3cbe246e" + "reference": "b25690f0fc25b2f0b91731370465a3b4e52ea587" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/claviska/SimpleImage/zipball/226d507cca0c8400d69bee7eb324158e3cbe246e", - "reference": "226d507cca0c8400d69bee7eb324158e3cbe246e", + "url": "https://api.github.com/repos/claviska/SimpleImage/zipball/b25690f0fc25b2f0b91731370465a3b4e52ea587", + "reference": "b25690f0fc25b2f0b91731370465a3b4e52ea587", "shasum": "" }, "require": { @@ -202,7 +204,7 @@ "description": "A PHP class that makes working with images as simple as possible.", "support": { "issues": "https://github.com/claviska/SimpleImage/issues", - "source": "https://github.com/claviska/SimpleImage/tree/4.0.2" + "source": "https://github.com/claviska/SimpleImage/tree/4.0.5" }, "funding": [ { @@ -210,7 +212,7 @@ "type": "github" } ], - "time": "2023-03-20T15:27:20+00:00" + "time": "2023-06-05T14:32:39+00:00" }, { "name": "composer/semver", @@ -365,16 +367,16 @@ }, { "name": "filp/whoops", - "version": "2.15.1", + "version": "2.15.2", "source": { "type": "git", "url": "https://github.com/filp/whoops.git", - "reference": "e864ac957acd66e1565f25efda61e37791a5db0b" + "reference": "aac9304c5ed61bf7b1b7a6064bf9806ab842ce73" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filp/whoops/zipball/e864ac957acd66e1565f25efda61e37791a5db0b", - "reference": "e864ac957acd66e1565f25efda61e37791a5db0b", + "url": "https://api.github.com/repos/filp/whoops/zipball/aac9304c5ed61bf7b1b7a6064bf9806ab842ce73", + "reference": "aac9304c5ed61bf7b1b7a6064bf9806ab842ce73", "shasum": "" }, "require": { @@ -424,7 +426,7 @@ ], "support": { "issues": "https://github.com/filp/whoops/issues", - "source": "https://github.com/filp/whoops/tree/2.15.1" + "source": "https://github.com/filp/whoops/tree/2.15.2" }, "funding": [ { @@ -432,24 +434,24 @@ "type": "github" } ], - "time": "2023-03-06T18:09:13+00:00" + "time": "2023-04-12T12:00:00+00:00" }, { "name": "getkirby/cms", - "version": "3.9.3", + "version": "3.9.6.1", "source": { "type": "git", "url": "https://github.com/getkirby/kirby.git", - "reference": "ce4aaace87ceca1f019a9cfc0293a69e662f9648" + "reference": "ee2669e6dd091399fd7981381e1bd8cbd94d90a6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/getkirby/kirby/zipball/ce4aaace87ceca1f019a9cfc0293a69e662f9648", - "reference": "ce4aaace87ceca1f019a9cfc0293a69e662f9648", + "url": "https://api.github.com/repos/getkirby/kirby/zipball/ee2669e6dd091399fd7981381e1bd8cbd94d90a6", + "reference": "ee2669e6dd091399fd7981381e1bd8cbd94d90a6", "shasum": "" }, "require": { - "claviska/simpleimage": "4.0.2", + "claviska/simpleimage": "4.0.5", "composer/semver": "3.3.2", "ext-ctype": "*", "ext-curl": "*", @@ -462,14 +464,15 @@ "ext-mbstring": "*", "ext-openssl": "*", "ext-simplexml": "*", - "filp/whoops": "2.15.1", + "filp/whoops": "2.15.2", "getkirby/composer-installer": "^1.2.1", "laminas/laminas-escaper": "2.12.0", "michelf/php-smartypants": "1.8.1", "php": ">=8.0.0 <8.3.0", "phpmailer/phpmailer": "6.8.0", "symfony/polyfill-intl-idn": "1.27.0", - "symfony/polyfill-mbstring": "1.27.0" + "symfony/polyfill-mbstring": "1.27.0", + "symfony/yaml": "5.4.23" }, "replace": { "symfony/polyfill-php72": "*" @@ -532,25 +535,25 @@ "type": "custom" } ], - "time": "2023-03-30T13:10:22+00:00" + "time": "2023-07-31T10:54:06+00:00" }, { "name": "guzzlehttp/guzzle", - "version": "7.5.1", + "version": "7.7.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "b964ca597e86b752cd994f27293e9fa6b6a95ed9" + "reference": "fb7566caccf22d74d1ab270de3551f72a58399f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/b964ca597e86b752cd994f27293e9fa6b6a95ed9", - "reference": "b964ca597e86b752cd994f27293e9fa6b6a95ed9", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/fb7566caccf22d74d1ab270de3551f72a58399f5", + "reference": "fb7566caccf22d74d1ab270de3551f72a58399f5", "shasum": "" }, "require": { "ext-json": "*", - "guzzlehttp/promises": "^1.5", + "guzzlehttp/promises": "^1.5.3 || ^2.0", "guzzlehttp/psr7": "^1.9.1 || ^2.4.5", "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0", @@ -562,7 +565,8 @@ "require-dev": { "bamarni/composer-bin-plugin": "^1.8.1", "ext-curl": "*", - "php-http/client-integration-tests": "^3.0", + "php-http/client-integration-tests": "dev-master#2c025848417c1135031fdf9c728ee53d0a7ceaee as 3.0.999", + "php-http/message-factory": "^1.1", "phpunit/phpunit": "^8.5.29 || ^9.5.23", "psr/log": "^1.1 || ^2.0 || ^3.0" }, @@ -576,9 +580,6 @@ "bamarni-bin": { "bin-links": true, "forward-command": false - }, - "branch-alias": { - "dev-master": "7.5-dev" } }, "autoload": { @@ -644,7 +645,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.5.1" + "source": "https://github.com/guzzle/guzzle/tree/7.7.0" }, "funding": [ { @@ -660,38 +661,37 @@ "type": "tidelift" } ], - "time": "2023-04-17T16:30:08+00:00" + "time": "2023-05-21T14:04:53+00:00" }, { "name": "guzzlehttp/promises", - "version": "1.5.2", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "b94b2807d85443f9719887892882d0329d1e2598" + "reference": "3a494dc7dc1d7d12e511890177ae2d0e6c107da6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/b94b2807d85443f9719887892882d0329d1e2598", - "reference": "b94b2807d85443f9719887892882d0329d1e2598", + "url": "https://api.github.com/repos/guzzle/promises/zipball/3a494dc7dc1d7d12e511890177ae2d0e6c107da6", + "reference": "3a494dc7dc1d7d12e511890177ae2d0e6c107da6", "shasum": "" }, "require": { - "php": ">=5.5" + "php": "^7.2.5 || ^8.0" }, "require-dev": { - "symfony/phpunit-bridge": "^4.4 || ^5.1" + "bamarni/composer-bin-plugin": "^1.8.1", + "phpunit/phpunit": "^8.5.29 || ^9.5.23" }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "1.5-dev" + "bamarni-bin": { + "bin-links": true, + "forward-command": false } }, "autoload": { - "files": [ - "src/functions_include.php" - ], "psr-4": { "GuzzleHttp\\Promise\\": "src/" } @@ -728,7 +728,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/1.5.2" + "source": "https://github.com/guzzle/promises/tree/2.0.0" }, "funding": [ { @@ -744,7 +744,7 @@ "type": "tidelift" } ], - "time": "2022-08-28T14:55:35+00:00" + "time": "2023-05-21T13:50:22+00:00" }, { "name": "guzzlehttp/psr7", @@ -1211,16 +1211,16 @@ }, { "name": "php-coveralls/php-coveralls", - "version": "v2.5.3", + "version": "v2.6.0", "source": { "type": "git", "url": "https://github.com/php-coveralls/php-coveralls.git", - "reference": "9d8243bbf0e053333692857c98fab7cfba0d60a9" + "reference": "9e88d7d38e9eab7c675da674481784321ea7a9bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-coveralls/php-coveralls/zipball/9d8243bbf0e053333692857c98fab7cfba0d60a9", - "reference": "9d8243bbf0e053333692857c98fab7cfba0d60a9", + "url": "https://api.github.com/repos/php-coveralls/php-coveralls/zipball/9e88d7d38e9eab7c675da674481784321ea7a9bc", + "reference": "9e88d7d38e9eab7c675da674481784321ea7a9bc", "shasum": "" }, "require": { @@ -1288,9 +1288,9 @@ ], "support": { "issues": "https://github.com/php-coveralls/php-coveralls/issues", - "source": "https://github.com/php-coveralls/php-coveralls/tree/v2.5.3" + "source": "https://github.com/php-coveralls/php-coveralls/tree/v2.6.0" }, - "time": "2022-09-12T20:47:09+00:00" + "time": "2023-07-16T08:39:10+00:00" }, { "name": "phpmailer/phpmailer", @@ -2204,16 +2204,16 @@ }, { "name": "sebastian/diff", - "version": "3.0.3", + "version": "3.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211" + "reference": "6296a0c086dd0117c1b78b059374d7fcbe7545ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/14f72dd46eaf2f2293cbe79c93cc0bc43161a211", - "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/6296a0c086dd0117c1b78b059374d7fcbe7545ae", + "reference": "6296a0c086dd0117c1b78b059374d7fcbe7545ae", "shasum": "" }, "require": { @@ -2258,7 +2258,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/3.0.3" + "source": "https://github.com/sebastianbergmann/diff/tree/3.0.4" }, "funding": [ { @@ -2266,7 +2266,7 @@ "type": "github" } ], - "time": "2020-11-30T07:59:04+00:00" + "time": "2023-05-07T05:30:20+00:00" }, { "name": "sebastian/environment", @@ -2410,16 +2410,16 @@ }, { "name": "sebastian/global-state", - "version": "3.0.2", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "de036ec91d55d2a9e0db2ba975b512cdb1c23921" + "reference": "66783ce213de415b451b904bfef9dda0cf9aeae0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/de036ec91d55d2a9e0db2ba975b512cdb1c23921", - "reference": "de036ec91d55d2a9e0db2ba975b512cdb1c23921", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/66783ce213de415b451b904bfef9dda0cf9aeae0", + "reference": "66783ce213de415b451b904bfef9dda0cf9aeae0", "shasum": "" }, "require": { @@ -2462,7 +2462,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/3.0.2" + "source": "https://github.com/sebastianbergmann/global-state/tree/3.0.3" }, "funding": [ { @@ -2470,7 +2470,7 @@ "type": "github" } ], - "time": "2022-02-10T06:55:38+00:00" + "time": "2023-08-02T09:23:32+00:00" }, { "name": "sebastian/object-enumerator", @@ -2804,38 +2804,35 @@ }, { "name": "symfony/config", - "version": "v6.0.19", + "version": "v6.3.2", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "db4fc45c24e0c3e2198e68ada9d7f90daa1f97e3" + "reference": "b47ca238b03e7b0d7880ffd1cf06e8d637ca1467" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/db4fc45c24e0c3e2198e68ada9d7f90daa1f97e3", - "reference": "db4fc45c24e0c3e2198e68ada9d7f90daa1f97e3", + "url": "https://api.github.com/repos/symfony/config/zipball/b47ca238b03e7b0d7880ffd1cf06e8d637ca1467", + "reference": "b47ca238b03e7b0d7880ffd1cf06e8d637ca1467", "shasum": "" }, "require": { - "php": ">=8.0.2", - "symfony/deprecation-contracts": "^2.1|^3", + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/filesystem": "^5.4|^6.0", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-php81": "^1.22" + "symfony/polyfill-ctype": "~1.8" }, "conflict": { - "symfony/finder": "<4.4" + "symfony/finder": "<5.4", + "symfony/service-contracts": "<2.5" }, "require-dev": { "symfony/event-dispatcher": "^5.4|^6.0", "symfony/finder": "^5.4|^6.0", "symfony/messenger": "^5.4|^6.0", - "symfony/service-contracts": "^1.1|^2|^3", + "symfony/service-contracts": "^2.5|^3", "symfony/yaml": "^5.4|^6.0" }, - "suggest": { - "symfony/yaml": "To use the yaml reference dumper" - }, "type": "library", "autoload": { "psr-4": { @@ -2862,7 +2859,7 @@ "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/config/tree/v6.0.19" + "source": "https://github.com/symfony/config/tree/v6.3.2" }, "funding": [ { @@ -2878,26 +2875,27 @@ "type": "tidelift" } ], - "time": "2023-01-09T04:36:00+00:00" + "time": "2023-07-19T20:22:16+00:00" }, { "name": "symfony/console", - "version": "v6.0.19", + "version": "v6.3.2", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "c3ebc83d031b71c39da318ca8b7a07ecc67507ed" + "reference": "aa5d64ad3f63f2e48964fc81ee45cb318a723898" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/c3ebc83d031b71c39da318ca8b7a07ecc67507ed", - "reference": "c3ebc83d031b71c39da318ca8b7a07ecc67507ed", + "url": "https://api.github.com/repos/symfony/console/zipball/aa5d64ad3f63f2e48964fc81ee45cb318a723898", + "reference": "aa5d64ad3f63f2e48964fc81ee45cb318a723898", "shasum": "" }, "require": { - "php": ">=8.0.2", + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/service-contracts": "^1.1|^2|^3", + "symfony/service-contracts": "^2.5|^3", "symfony/string": "^5.4|^6.0" }, "conflict": { @@ -2919,12 +2917,6 @@ "symfony/process": "^5.4|^6.0", "symfony/var-dumper": "^5.4|^6.0" }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" - }, "type": "library", "autoload": { "psr-4": { @@ -2952,12 +2944,12 @@ "homepage": "https://symfony.com", "keywords": [ "cli", - "command line", + "command-line", "console", "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.0.19" + "source": "https://github.com/symfony/console/tree/v6.3.2" }, "funding": [ { @@ -2973,29 +2965,29 @@ "type": "tidelift" } ], - "time": "2023-01-01T08:36:10+00:00" + "time": "2023-07-19T20:17:28+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v3.0.2", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c" + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", - "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", "shasum": "" }, "require": { - "php": ">=8.0.2" + "php": ">=8.1" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -3024,7 +3016,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.2" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.3.0" }, "funding": [ { @@ -3040,24 +3032,24 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:55:41+00:00" + "time": "2023-05-23T14:45:45+00:00" }, { "name": "symfony/filesystem", - "version": "v6.0.19", + "version": "v6.3.1", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "3d49eec03fda1f0fc19b7349fbbe55ebc1004214" + "reference": "edd36776956f2a6fcf577edb5b05eb0e3bdc52ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/3d49eec03fda1f0fc19b7349fbbe55ebc1004214", - "reference": "3d49eec03fda1f0fc19b7349fbbe55ebc1004214", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/edd36776956f2a6fcf577edb5b05eb0e3bdc52ae", + "reference": "edd36776956f2a6fcf577edb5b05eb0e3bdc52ae", "shasum": "" }, "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-mbstring": "~1.8" }, @@ -3087,7 +3079,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v6.0.19" + "source": "https://github.com/symfony/filesystem/tree/v6.3.1" }, "funding": [ { @@ -3103,7 +3095,7 @@ "type": "tidelift" } ], - "time": "2023-01-20T17:44:14+00:00" + "time": "2023-06-01T08:30:39+00:00" }, { "name": "symfony/polyfill-ctype", @@ -3522,113 +3514,31 @@ ], "time": "2022-11-03T14:55:06+00:00" }, - { - "name": "symfony/polyfill-php81", - "version": "v1.27.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "707403074c8ea6e2edaf8794b0157a0bfa52157a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/707403074c8ea6e2edaf8794b0157a0bfa52157a", - "reference": "707403074c8ea6e2edaf8794b0157a0bfa52157a", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php81\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.27.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2022-11-03T14:55:06+00:00" - }, { "name": "symfony/service-contracts", - "version": "v3.0.2", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "d78d39c1599bd1188b8e26bb341da52c3c6d8a66" + "reference": "40da9cc13ec349d9e4966ce18b5fbcd724ab10a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/d78d39c1599bd1188b8e26bb341da52c3c6d8a66", - "reference": "d78d39c1599bd1188b8e26bb341da52c3c6d8a66", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/40da9cc13ec349d9e4966ce18b5fbcd724ab10a4", + "reference": "40da9cc13ec349d9e4966ce18b5fbcd724ab10a4", "shasum": "" }, "require": { - "php": ">=8.0.2", + "php": ">=8.1", "psr/container": "^2.0" }, "conflict": { "ext-psr": "<1.1|>=2" }, - "suggest": { - "symfony/service-implementation": "" - }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -3638,7 +3548,10 @@ "autoload": { "psr-4": { "Symfony\\Contracts\\Service\\": "" - } + }, + "exclude-from-classmap": [ + "/Test/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3665,7 +3578,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.0.2" + "source": "https://github.com/symfony/service-contracts/tree/v3.3.0" }, "funding": [ { @@ -3681,25 +3594,25 @@ "type": "tidelift" } ], - "time": "2022-05-30T19:17:58+00:00" + "time": "2023-05-23T14:45:45+00:00" }, { "name": "symfony/stopwatch", - "version": "v6.0.19", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "011e781839dd1d2eb8119f65ac516a530f60226d" + "reference": "fc47f1015ec80927ff64ba9094dfe8b9d48fe9f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/011e781839dd1d2eb8119f65ac516a530f60226d", - "reference": "011e781839dd1d2eb8119f65ac516a530f60226d", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/fc47f1015ec80927ff64ba9094dfe8b9d48fe9f2", + "reference": "fc47f1015ec80927ff64ba9094dfe8b9d48fe9f2", "shasum": "" }, "require": { - "php": ">=8.0.2", - "symfony/service-contracts": "^1|^2|^3" + "php": ">=8.1", + "symfony/service-contracts": "^2.5|^3" }, "type": "library", "autoload": { @@ -3727,7 +3640,7 @@ "description": "Provides a way to profile code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/stopwatch/tree/v6.0.19" + "source": "https://github.com/symfony/stopwatch/tree/v6.3.0" }, "funding": [ { @@ -3743,36 +3656,37 @@ "type": "tidelift" } ], - "time": "2023-01-01T08:36:10+00:00" + "time": "2023-02-16T10:14:28+00:00" }, { "name": "symfony/string", - "version": "v6.0.19", + "version": "v6.3.2", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "d9e72497367c23e08bf94176d2be45b00a9d232a" + "reference": "53d1a83225002635bca3482fcbf963001313fb68" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/d9e72497367c23e08bf94176d2be45b00a9d232a", - "reference": "d9e72497367c23e08bf94176d2be45b00a9d232a", + "url": "https://api.github.com/repos/symfony/string/zipball/53d1a83225002635bca3482fcbf963001313fb68", + "reference": "53d1a83225002635bca3482fcbf963001313fb68", "shasum": "" }, "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/translation-contracts": "<2.0" + "symfony/translation-contracts": "<2.5" }, "require-dev": { "symfony/error-handler": "^5.4|^6.0", "symfony/http-client": "^5.4|^6.0", - "symfony/translation-contracts": "^2.0|^3.0", + "symfony/intl": "^6.2", + "symfony/translation-contracts": "^2.5|^3.0", "symfony/var-exporter": "^5.4|^6.0" }, "type": "library", @@ -3812,7 +3726,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.0.19" + "source": "https://github.com/symfony/string/tree/v6.3.2" }, "funding": [ { @@ -3828,31 +3742,32 @@ "type": "tidelift" } ], - "time": "2023-01-01T08:36:10+00:00" + "time": "2023-07-05T08:41:27+00:00" }, { "name": "symfony/yaml", - "version": "v6.0.19", + "version": "v5.4.23", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "deec3a812a0305a50db8ae689b183f43d915c884" + "reference": "4cd2e3ea301aadd76a4172756296fe552fb45b0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/deec3a812a0305a50db8ae689b183f43d915c884", - "reference": "deec3a812a0305a50db8ae689b183f43d915c884", + "url": "https://api.github.com/repos/symfony/yaml/zipball/4cd2e3ea301aadd76a4172756296fe552fb45b0b", + "reference": "4cd2e3ea301aadd76a4172756296fe552fb45b0b", "shasum": "" }, "require": { - "php": ">=8.0.2", + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "symfony/console": "<5.4" + "symfony/console": "<5.3" }, "require-dev": { - "symfony/console": "^5.4|^6.0" + "symfony/console": "^5.3|^6.0" }, "suggest": { "symfony/console": "For validating YAML files using the lint command" @@ -3886,7 +3801,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v6.0.19" + "source": "https://github.com/symfony/yaml/tree/v5.4.23" }, "funding": [ { @@ -3902,7 +3817,7 @@ "type": "tidelift" } ], - "time": "2023-01-11T11:50:03+00:00" + "time": "2023-04-23T19:33:36+00:00" }, { "name": "theseer/tokenizer", diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 65f5dd8..1b4ebf8 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -126,12 +126,10 @@ 'Kigkonsult\\Icalcreator\\Util\\DateTimeZoneFactory' => $vendorDir . '/kigkonsult/icalcreator/src/Util/DateTimeZoneFactory.php', 'Kigkonsult\\Icalcreator\\Util\\GeoFactory' => $vendorDir . '/kigkonsult/icalcreator/src/Util/GeoFactory.php', 'Kigkonsult\\Icalcreator\\Util\\HttpFactory' => $vendorDir . '/kigkonsult/icalcreator/src/Util/HttpFactory.php', - 'Kigkonsult\\Icalcreator\\Util\\IcalXMLFactory' => $vendorDir . '/kigkonsult/icalcreator/src/Util/IcalXMLFactory.php', 'Kigkonsult\\Icalcreator\\Util\\IcalvCardFactory' => $vendorDir . '/kigkonsult/icalcreator/src/Util/IcalvCardFactory.php', 'Kigkonsult\\Icalcreator\\Util\\ParameterFactory' => $vendorDir . '/kigkonsult/icalcreator/src/Util/ParameterFactory.php', 'Kigkonsult\\Icalcreator\\Util\\RecurFactory' => $vendorDir . '/kigkonsult/icalcreator/src/Util/RecurFactory.php', 'Kigkonsult\\Icalcreator\\Util\\RecurFactory2' => $vendorDir . '/kigkonsult/icalcreator/src/Util/RecurFactory2.php', - 'Kigkonsult\\Icalcreator\\Util\\RegulateTimezoneFactory' => $vendorDir . '/kigkonsult/icalcreator/src/Util/RegulateTimezoneFactory.php', 'Kigkonsult\\Icalcreator\\Util\\RexdateFactory' => $vendorDir . '/kigkonsult/icalcreator/src/Util/RexdateFactory.php', 'Kigkonsult\\Icalcreator\\Util\\SelectFactory' => $vendorDir . '/kigkonsult/icalcreator/src/Util/SelectFactory.php', 'Kigkonsult\\Icalcreator\\Util\\SortFactory' => $vendorDir . '/kigkonsult/icalcreator/src/Util/SortFactory.php', diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 254fc20..d00e50b 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -160,12 +160,10 @@ class ComposerStaticInit491e638a5eef9e53f1ce44550339b2cd 'Kigkonsult\\Icalcreator\\Util\\DateTimeZoneFactory' => __DIR__ . '/..' . '/kigkonsult/icalcreator/src/Util/DateTimeZoneFactory.php', 'Kigkonsult\\Icalcreator\\Util\\GeoFactory' => __DIR__ . '/..' . '/kigkonsult/icalcreator/src/Util/GeoFactory.php', 'Kigkonsult\\Icalcreator\\Util\\HttpFactory' => __DIR__ . '/..' . '/kigkonsult/icalcreator/src/Util/HttpFactory.php', - 'Kigkonsult\\Icalcreator\\Util\\IcalXMLFactory' => __DIR__ . '/..' . '/kigkonsult/icalcreator/src/Util/IcalXMLFactory.php', 'Kigkonsult\\Icalcreator\\Util\\IcalvCardFactory' => __DIR__ . '/..' . '/kigkonsult/icalcreator/src/Util/IcalvCardFactory.php', 'Kigkonsult\\Icalcreator\\Util\\ParameterFactory' => __DIR__ . '/..' . '/kigkonsult/icalcreator/src/Util/ParameterFactory.php', 'Kigkonsult\\Icalcreator\\Util\\RecurFactory' => __DIR__ . '/..' . '/kigkonsult/icalcreator/src/Util/RecurFactory.php', 'Kigkonsult\\Icalcreator\\Util\\RecurFactory2' => __DIR__ . '/..' . '/kigkonsult/icalcreator/src/Util/RecurFactory2.php', - 'Kigkonsult\\Icalcreator\\Util\\RegulateTimezoneFactory' => __DIR__ . '/..' . '/kigkonsult/icalcreator/src/Util/RegulateTimezoneFactory.php', 'Kigkonsult\\Icalcreator\\Util\\RexdateFactory' => __DIR__ . '/..' . '/kigkonsult/icalcreator/src/Util/RexdateFactory.php', 'Kigkonsult\\Icalcreator\\Util\\SelectFactory' => __DIR__ . '/..' . '/kigkonsult/icalcreator/src/Util/SelectFactory.php', 'Kigkonsult\\Icalcreator\\Util\\SortFactory' => __DIR__ . '/..' . '/kigkonsult/icalcreator/src/Util/SortFactory.php', diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 028a20d..5d15eaa 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -1,8 +1,8 @@ array( 'name' => 'bnomei/kirby3-ics', - 'pretty_version' => '1.0.6', - 'version' => '1.0.6.0', + 'pretty_version' => '1.0.7', + 'version' => '1.0.7.0', 'reference' => NULL, 'type' => 'kirby-plugin', 'install_path' => __DIR__ . '/../../', @@ -11,8 +11,8 @@ ), 'versions' => array( 'bnomei/kirby3-ics' => array( - 'pretty_version' => '1.0.6', - 'version' => '1.0.6.0', + 'pretty_version' => '1.0.7', + 'version' => '1.0.7.0', 'reference' => NULL, 'type' => 'kirby-plugin', 'install_path' => __DIR__ . '/../../', @@ -29,9 +29,9 @@ 'dev_requirement' => false, ), 'kigkonsult/icalcreator' => array( - 'pretty_version' => 'v2.41.74', - 'version' => '2.41.74.0', - 'reference' => '35b57afc03c07ff8e213ebda7c50f37f70d54526', + 'pretty_version' => 'v2.41.80', + 'version' => '2.41.80.0', + 'reference' => 'a15c9b48caa2b50e077f5a9595f889c965d58667', 'type' => 'library', 'install_path' => __DIR__ . '/../kigkonsult/icalcreator', 'aliases' => array(), diff --git a/vendor/kigkonsult/icalcreator/autoload.php b/vendor/kigkonsult/icalcreator/autoload.php index a177dd3..f9f14a4 100644 --- a/vendor/kigkonsult/icalcreator/autoload.php +++ b/vendor/kigkonsult/icalcreator/autoload.php @@ -31,13 +31,13 @@ * * iCalcreator package autoloader * - * @since 2.41.74 - 2023-03-15 + * @since 2.41.80 - 2023-06-27 */ /** * Do NOT alter or remove the constant!! */ -define( 'ICALCREATOR_VERSION', 'iCalcreator 2.41.74' ); +define( 'ICALCREATOR_VERSION', 'iCalcreator 2.41.80' ); /** * load iCalcreator src and support classes and Traits diff --git a/vendor/kigkonsult/icalcreator/src/CalendarComponent.php b/vendor/kigkonsult/icalcreator/src/CalendarComponent.php index 2bd1e89..1154be0 100644 --- a/vendor/kigkonsult/icalcreator/src/CalendarComponent.php +++ b/vendor/kigkonsult/icalcreator/src/CalendarComponent.php @@ -34,7 +34,6 @@ use Kigkonsult\Icalcreator\Parser\ComponentParser; use Kigkonsult\Icalcreator\Util\StringFactory; use Kigkonsult\Icalcreator\Util\Util; -use UnexpectedValueException; use function is_array; use function ksort; @@ -131,7 +130,6 @@ public function getProperties( string $propName, array & $output ) : void * @param null|string|string[] $unParsedText strict rfc2445 formatted, single property string or array of strings * @return static * @throws Exception - * @throws UnexpectedValueException; * @since 2.41.54 - 2022-08-09 * @// todo report invalid properties, Exception.. ?? */ diff --git a/vendor/kigkonsult/icalcreator/src/Formatter/Property/Rdate.php b/vendor/kigkonsult/icalcreator/src/Formatter/Property/Rdate.php index 547fb5d..6e8854d 100644 --- a/vendor/kigkonsult/icalcreator/src/Formatter/Property/Rdate.php +++ b/vendor/kigkonsult/icalcreator/src/Formatter/Property/Rdate.php @@ -112,9 +112,9 @@ public static function format( } /** - * @param mixed[] $rdatePart - * @param bool $isValueDate - * @param bool $isLocalTime + * @param array $rdatePart + * @param bool $isValueDate + * @param bool $isLocalTime * @return string * @throws Exception */ diff --git a/vendor/kigkonsult/icalcreator/src/Formatter/Property/Xproperty.php b/vendor/kigkonsult/icalcreator/src/Formatter/Property/Xproperty.php index d249d9b..30f90d1 100644 --- a/vendor/kigkonsult/icalcreator/src/Formatter/Property/Xproperty.php +++ b/vendor/kigkonsult/icalcreator/src/Formatter/Property/Xproperty.php @@ -40,8 +40,8 @@ final class Xproperty extends PropertyBase { /** - * @param mixed[] $values [ *( propname, Pc ) ] - * @param null|bool $allowEmpty + * @param array $values [ *( propname, Pc ) ] + * @param null|bool $allowEmpty * @param null|bool|string $lang * @return string */ diff --git a/vendor/kigkonsult/icalcreator/src/IcalBase.php b/vendor/kigkonsult/icalcreator/src/IcalBase.php index dc2984b..cc7f39a 100644 --- a/vendor/kigkonsult/icalcreator/src/IcalBase.php +++ b/vendor/kigkonsult/icalcreator/src/IcalBase.php @@ -59,7 +59,7 @@ * Do NOT alter or remove the constant!! */ if( ! defined( 'ICALCREATOR_VERSION' )) { - define( 'ICALCREATOR_VERSION', 'iCalcreator 2.41.74' ); + define( 'ICALCREATOR_VERSION', 'iCalcreator 2.41.80' ); } /** @@ -131,7 +131,7 @@ public static function isTzComp( ? string $compName ) : bool * @return bool * @since 2.41.68 2022-10-03 */ - protected static function isCalendarSubComp( string $compName ) : bool + public static function isCalendarSubComp( string $compName ) : bool { static $CALCOMPS = [ self::AVAILABLE, @@ -151,6 +151,7 @@ protected static function isCalendarSubComp( string $compName ) : bool /** * Return bool true if component has the UID property + * * @param IcalBase $component * @return bool * @since 2.47.68 2022-10-01 @@ -236,7 +237,7 @@ protected static function isDateProp( string $propName ) : bool protected array $components = []; /** - * @var mixed[] $config configuration with defaults + * @var array $config configuration with defaults */ protected array $config = [ self::ALLOWEMPTY => true, @@ -418,7 +419,7 @@ public function getConfig( ? string $config = null ) : mixed /** * Return array( propertyName => count ) * - * @return mixed[] + * @return array * @since 2.41.51 2022-08-09 */ protected function getpropInfo() : array @@ -466,9 +467,9 @@ protected function getpropInfo() : array /** * Set Vcalendar/component config * - * @param string|string[] $config - * @param null|bool|string|mixed[] $value - * @param bool $softUpdate + * @param string|string[] $config + * @param null|bool|string|array $value + * @param bool $softUpdate * @return static * @throws InvalidArgumentException * @since 2.40.11 - 2022-01-25 @@ -663,7 +664,9 @@ public function getComponent( ++$cix1gC; } break; - case ( ! $argType && ( $arg1 === $this->components[$cix]->getUid())) : + case ( ! $argType && + self::hasUid( $this->components[$cix] ) && + ( $arg1 === $this->components[$cix]->getUid())) : if( $index === $cix1gC ) { return clone $this->components[$cix]; } @@ -705,7 +708,7 @@ protected function getCompixIndex( string $arg1, null|int|string $arg2 = null ) * @param CalendarComponent $component * @param string[] $argList * @return bool - * @since 2.47.68 - 2022-10-03 + * @since 2.47.76 - 2023-04-29 */ protected static function isFoundInCompsProps( CalendarComponent $component, @@ -713,7 +716,7 @@ protected static function isFoundInCompsProps( ) : bool { foreach( $argList as $propName => $propValue ) { - if( in_array( $propName, [ self::ATTENDEE, self::CONTACT, self::ORGANIZER ], true ) ) { + if( in_array( $propName, [ self::ATTENDEE, self::CONTACT, self::ORGANIZER ], true )) { $propValue = CalAddressFactory::conformCalAddress( $propValue ); } switch( true ) { @@ -737,7 +740,7 @@ protected static function isFoundInCompsProps( if( false === ( $value = $component->{$method}())) { // single occurrence continue; // missing/empty property } - switch( true ) { + switch( true ) { case ( self::SUMMARY === $propName ) : // exists in (any case) if( false !== stripos( $value, $propValue )) { return true; @@ -760,10 +763,8 @@ protected static function isFoundInCompsProps( $part = ( is_string( $part ) && ( str_contains( $part, Util::$COMMA ))) ? explode( Util::$COMMA, $part ) : [ $part ]; - foreach( $part as $subPart ) { - if( $propValue == $subPart ) { // note == - return true; - } + if( in_array( $propValue, $part )) { // note no true + return true; } } // end foreach( $value as $part ) } // end foreach( $arg1 as $propName => $propValue ) diff --git a/vendor/kigkonsult/icalcreator/src/Parser/ComponentParser.php b/vendor/kigkonsult/icalcreator/src/Parser/ComponentParser.php index 710196c..0e39783 100644 --- a/vendor/kigkonsult/icalcreator/src/Parser/ComponentParser.php +++ b/vendor/kigkonsult/icalcreator/src/Parser/ComponentParser.php @@ -32,6 +32,7 @@ use Exception; use Kigkonsult\Icalcreator\CalendarComponent; use Kigkonsult\Icalcreator\Util\StringFactory; +use RuntimeException; use function count; use function ctype_alpha; @@ -54,13 +55,18 @@ final class ComponentParser extends ParserBase { /** * @inheritDoc - * @throws Exception + * @throws RuntimeException */ public function parse( null|array|string $unParsedText = null ) : CalendarComponent { - $rows = $this->parse1prepInput( $unParsedText ); - if( ! empty( $rows )) { - $this->parse2intoComps( $rows ); + try { + $rows = $this->parse1prepInput( $unParsedText ); + if( ! empty( $rows ) ) { + $this->parse2intoComps( $rows ); + } + } + catch( Exception $e ) { + throw new RuntimeException( $e->getMessage(), $e->getCode(), $e ); } return $this->subject; } diff --git a/vendor/kigkonsult/icalcreator/src/Parser/ParserBase.php b/vendor/kigkonsult/icalcreator/src/Parser/ParserBase.php index 22db3eb..a5dabb0 100644 --- a/vendor/kigkonsult/icalcreator/src/Parser/ParserBase.php +++ b/vendor/kigkonsult/icalcreator/src/Parser/ParserBase.php @@ -32,10 +32,10 @@ use Exception; use Kigkonsult\Icalcreator\CalendarComponent; use Kigkonsult\Icalcreator\IcalInterface; +use Kigkonsult\Icalcreator\Util\CalAddressFactory; use Kigkonsult\Icalcreator\Util\StringFactory; use Kigkonsult\Icalcreator\Util\Util; use Kigkonsult\Icalcreator\Vcalendar; - use function bin2hex; use function count; use function ctype_digit; @@ -44,10 +44,10 @@ use function rtrim; use function sprintf; use function str_replace; +use function stristr; use function strlen; use function strpos; use function strstr; -use function stristr; use function strtolower; use function strtoupper; use function substr; @@ -83,26 +83,6 @@ abstract class ParserBase implements IcalInterface */ protected static string $SP0 = ''; - /** - * Protocols - * - * @var string[] - */ - public static array $PROTO3 = [ 'cid:', 'sms:', 'tel:', 'urn:' ]; - - /** - * @var string[] dito - */ - public static array $PROTO5 = [ 'https:' ]; - /** - * @var string[] dito - */ - public static array $PROTO6 = [ 'mailto:', 'telnet:' ]; - /** - * @var string[] dito - */ - public static array $PROTO7 = [ 'message:' ]; - /** * @var string[] iCal component TEXT properties that may contain '\\', ',', ';' * @usedby VcalendarParser + ComponentParser @@ -387,11 +367,11 @@ public static function colonIsPrefixedByProtocol( string $line, int $cix ) : boo static $MSTZ = [ 'utc-', 'utc+', 'gmt-', 'gmt+' ]; $line = strtolower( $line ); return ( ( in_array( substr( $line, $cix - 6, 4 ), $MSTZ )) || // ?? -6 - ( in_array( substr( $line, $cix - 3, 4 ), self::$PROTO3, true )) || - ( in_array( substr( $line, $cix - 4, 5 ), StringFactory::$PROTO4, true )) || - ( in_array( substr( $line, $cix - 5, 6 ), self::$PROTO5, true )) || - ( in_array( substr( $line, $cix - 6, 7 ), self::$PROTO6, true )) || - ( in_array( substr( $line, $cix - 7, 8 ), self::$PROTO7, true ))); + ( in_array( substr( $line, $cix - 3, 4 ), CalAddressFactory::$PROTO3, true )) || + ( in_array( substr( $line, $cix - 4, 5 ), CalAddressFactory::$PROTO4, true )) || + ( in_array( substr( $line, $cix - 5, 6 ), CalAddressFactory::$PROTO5, true )) || + ( in_array( substr( $line, $cix - 6, 7 ), CalAddressFactory::$PROTO6, true )) || + ( in_array( substr( $line, $cix - 7, 8 ), CalAddressFactory::$PROTO7, true ))); } /** @@ -480,7 +460,7 @@ public static function concatRows( array $rows ) : array for( $i = 0; $i < $cnt; $i++ ) { $line = rtrim( $rows[$i], Util::$CRLF ); $i1 = $i + 1; - while(( $i < $cnt ) && isset( $rows[$i1] ) && + while( ( $i < $cnt ) && ! empty( $rows[$i1] ) && in_array( $rows[$i1][0], $CHARs )) { ++$i; diff --git a/vendor/kigkonsult/icalcreator/src/Parser/VcalendarParser.php b/vendor/kigkonsult/icalcreator/src/Parser/VcalendarParser.php index 1ad8806..05e38aa 100644 --- a/vendor/kigkonsult/icalcreator/src/Parser/VcalendarParser.php +++ b/vendor/kigkonsult/icalcreator/src/Parser/VcalendarParser.php @@ -276,7 +276,6 @@ private function parse3thisProperties() : void self::URL, ]; if( ! isset( $this->unparsed ) || - ! is_array( $this->unparsed ) || ( 1 > count( $this->unparsed ))) { return; } diff --git a/vendor/kigkonsult/icalcreator/src/Pc.php b/vendor/kigkonsult/icalcreator/src/Pc.php index 1d227ad..a43ae54 100644 --- a/vendor/kigkonsult/icalcreator/src/Pc.php +++ b/vendor/kigkonsult/icalcreator/src/Pc.php @@ -40,11 +40,15 @@ class Pc extends ArrayObject * Class constructor * * @overrides - * @param array $array ignored - * @param int $flags ignored - * @param string $iteratorClass ArrayIterator - */ - public function __construct( $array = [], $flags = 0, $iteratorClass = 'ArrayIterator' ) + * @param null|array $array ignored + * @param null|int $flags ignored + * @param null|string $iteratorClass ArrayIterator + */ + public function __construct( + ? array $array = [], + ? int $flags = 0, + ? string $iteratorClass = 'ArrayIterator' + ) { parent::__construct( self::$propTmpl, ArrayObject::ARRAY_AS_PROPS, self::$iteratorTmpl ); } diff --git a/vendor/kigkonsult/icalcreator/src/Traits/CALSCALEtrait.php b/vendor/kigkonsult/icalcreator/src/Traits/CALSCALEtrait.php index 7da6f01..e5cb0df 100644 --- a/vendor/kigkonsult/icalcreator/src/Traits/CALSCALEtrait.php +++ b/vendor/kigkonsult/icalcreator/src/Traits/CALSCALEtrait.php @@ -97,7 +97,7 @@ public function isCalscaleSet() : bool * * @param null|string $value * @return static - * @throws InvalidArgumentException; + * @throws InvalidArgumentException * @since 2.29.14 - 2019-09-03 */ public function setCalscale( null|string $value = null ) : static diff --git a/vendor/kigkonsult/icalcreator/src/Traits/EXRULEtrait.php b/vendor/kigkonsult/icalcreator/src/Traits/EXRULEtrait.php index 0fec367..51f961a 100644 --- a/vendor/kigkonsult/icalcreator/src/Traits/EXRULEtrait.php +++ b/vendor/kigkonsult/icalcreator/src/Traits/EXRULEtrait.php @@ -107,14 +107,14 @@ public function isExruleSet() : bool /** * Set calendar component property exrule * - * @param null|array $exruleset + * @param null|array|Pc $exruleset * @param null|array $params * @return static * @throws InvalidArgumentException * @throws Exception - * @since 2.41.36 2022-04-03 + * @since 2.41.76 2023-04-29 */ - public function setExrule( ? array $exruleset = null, ? array $params = [] ) : static + public function setExrule( null|array|Pc $exruleset = null, ? array $params = [] ) : static { $value = ( $exruleset instanceof Pc ) ? clone $exruleset diff --git a/vendor/kigkonsult/icalcreator/src/Traits/FREEBUSYtrait.php b/vendor/kigkonsult/icalcreator/src/Traits/FREEBUSYtrait.php index b1401e7..64db593 100644 --- a/vendor/kigkonsult/icalcreator/src/Traits/FREEBUSYtrait.php +++ b/vendor/kigkonsult/icalcreator/src/Traits/FREEBUSYtrait.php @@ -186,7 +186,8 @@ public function setFreebusy( } else { $fbType = ( empty( $fbType )) ? self::BUSY : strtoupper( $fbType ); - if( ! in_array( $fbType, self::$FREEBUSYKEYS ) && ! StringFactory::isXprefixed( $fbType )) { + if( ! in_array( $fbType, self::$FREEBUSYKEYS, true ) && + ! StringFactory::isXprefixed( $fbType )) { $fbType = self::BUSY; } $value = Pc::factory( $fbValues, ParameterFactory::setParams( $params )) diff --git a/vendor/kigkonsult/icalcreator/src/Traits/ORGANIZERtrait.php b/vendor/kigkonsult/icalcreator/src/Traits/ORGANIZERtrait.php index c7213c9..ceba165 100644 --- a/vendor/kigkonsult/icalcreator/src/Traits/ORGANIZERtrait.php +++ b/vendor/kigkonsult/icalcreator/src/Traits/ORGANIZERtrait.php @@ -39,7 +39,7 @@ /** * ORGANIZER property functions * - * @since 2.41.55 2022-08-13 + * @since 2.41.80 2023-06-27 */ trait ORGANIZERtrait { @@ -108,7 +108,7 @@ public function isOrganizerSet() : bool * @param null|array $params * @return static * @throws InvalidArgumentException - * @since 2.41.36 2022-04-03 + * @since 2.41.80 2023-06-27 */ public function setOrganizer( null|string|Pc $value = null, ? array $params = [] ) : static { @@ -121,9 +121,14 @@ public function setOrganizer( null|string|Pc $value = null, ? array $params = [] } else { Util::assertString( $value->value, self::ORGANIZER ); - $value->value = CalAddressFactory::conformCalAddress( $value->value, true ); - CalAddressFactory::assertCalAddress( $value->value ); - CalAddressFactory::sameValueAndEMAILparam( $value ); + if( ! CalAddressFactory::hasProtocolPrefix( $value->value )) { + $value->value = CalAddressFactory::conformCalAddress( $value->value, true ); + } + if( CalAddressFactory::hasMailtoPrefix( $value->value )) { + $value->value = CalAddressFactory::conformCalAddress( $value->value ); + CalAddressFactory::assertCalAddress( $value->value ); + CalAddressFactory::sameValueAndEMAILparam( $value ); + } } $this->organizer = $value; if( $this->organizer->hasParamKey( self::EMAIL )) { diff --git a/vendor/kigkonsult/icalcreator/src/Traits/Participants2AttendeesTrait.php b/vendor/kigkonsult/icalcreator/src/Traits/Participants2AttendeesTrait.php index b2a7867..e8d457c 100644 --- a/vendor/kigkonsult/icalcreator/src/Traits/Participants2AttendeesTrait.php +++ b/vendor/kigkonsult/icalcreator/src/Traits/Participants2AttendeesTrait.php @@ -46,7 +46,7 @@ trait Participants2AttendeesTrait */ public function participants2Attendees() : static { - if( ! in_array( $this->getCompType(), Vcalendar::$VCOMBS )) { + if( ! in_array( $this->getCompType(), Vcalendar::$VCOMBS, true )) { return $this; } [ $participants, $lcArr ] = $this->getSubCompsDetailType( diff --git a/vendor/kigkonsult/icalcreator/src/Util/CalAddressFactory.php b/vendor/kigkonsult/icalcreator/src/Util/CalAddressFactory.php index 05e087a..3e6d3bd 100644 --- a/vendor/kigkonsult/icalcreator/src/Util/CalAddressFactory.php +++ b/vendor/kigkonsult/icalcreator/src/Util/CalAddressFactory.php @@ -35,7 +35,7 @@ use Kigkonsult\Icalcreator\Pc; use Kigkonsult\Icalcreator\Vcalendar; use Kigkonsult\Icalcreator\Vevent; - +use function array_merge; use function in_array; use function method_exists; use function sprintf; @@ -47,10 +47,21 @@ /** * iCalcreator attendee support class * - * @since 2.41.68 - 2022-10-21 + * @since 2.41.80 - 2023-06-27 */ class CalAddressFactory { + /** + * Protocols + * + * @var string[] + */ + public static array $PROTO3 = [ 'cid:', 'sms:', 'tel:', 'urn:' ]; + public static array $PROTO4 = [ 'crid:', 'news:', 'pres:', 'http:', ':http:' ]; + public static array $PROTO5 = [ 'https:' ]; + public static array $PROTO6 = [ 'mailto:', 'telnet:' ]; + public static array $PROTO7 = [ 'message:' ]; + /** * @var string[] */ @@ -62,7 +73,7 @@ class CalAddressFactory ]; /** - * @var string Prefix for Ical cal-address etc + * @var string Prefix (protocol) for Ical cal-address etc * @since 2.41.52 2022-08-06 */ public static string $MAILTOCOLON = 'mailto:'; @@ -123,14 +134,42 @@ public static function conformCalAddress( string $calAddress, ? bool $forceMailt return $calAddress; } + /** + * Return bool true if string starts with protocol + * + * @param string $value + * @return bool + * @since 2.41.80 - 2023-06-27 + */ + public static function hasProtocolPrefix( string $value ) : bool + { + static $PROTOCOLS = null; + if( null === $PROTOCOLS ) { + $PROTOCOLS = array_merge( + self::$PROTO3, + self::$PROTO4, + self::$PROTO5, + self::$PROTO6, + self::$PROTO7, + ); + } + $cmpValue = strtolower( $value ); + foreach( $PROTOCOLS as $prtcl ) { + if( str_starts_with( $cmpValue, $prtcl )) { + return true; + } + } // end foreach + return false; + } + /** * Return bool true if email has leading mailto: * * @param string $email * @return bool - * @since 2.27.8 - 2019-03-17 + * @since 2.41.80 - 2023-06-27 */ - private static function hasMailtoPrefix( string $email ) : bool + public static function hasMailtoPrefix( string $email ) : bool { return ( 0 === strcasecmp( self::$MAILTOCOLON, substr( $email, 0, 7 ))); } @@ -316,9 +355,9 @@ public static function getCalAdressesAllFromProperty( * * @param CalendarComponent|Vevent $component iCalcreator Vcalendar component instance * @return string[] - * @since 2.41.36 - 2022-04-03 + * @since 2.41.76 - 2023-04-29 */ - public static function getCalAdressesAllFromAttendee( CalendarComponent $component ) : array + public static function getCalAdressesAllFromAttendee( CalendarComponent|Vevent $component ) : array { $output = []; foreach( $component->getAllAttendee( true ) as $propValue ) { @@ -334,10 +373,9 @@ public static function getCalAdressesAllFromAttendee( CalendarComponent $compone case IcalInterface::MEMBER: // fall through case IcalInterface::DELEGATED_TO: // fall through case IcalInterface::DELEGATED_FROM: - $params2[$pLabel] = []; foreach( $pValue as $pValue2 ) { $pValue2 = self::removeMailtoPrefix( trim( $pValue2, StringFactory::$QQ )); - if( !in_array( $pValue2, $output, true )) { + if( ! in_array( $pValue2, $output, true )) { $output[] = $pValue2; } } // end foreach @@ -364,7 +402,7 @@ public static function getCalAdressesAllFromAttendee( CalendarComponent $compone * @return string[] * @since 2.41.36 - 2022-04-03 */ - public static function getCalAdressesAllFromOrganizer( CalendarComponent $component ) : array + public static function getCalAdressesAllFromOrganizer( CalendarComponent|Vevent $component ) : array { if(( false === ( $propValue = $component->getOrganizer( true ))) || empty( $propValue )) { @@ -393,7 +431,7 @@ public static function getCalAdressesAllFromOrganizer( CalendarComponent $compon * @return string[] * @since 2.29 - 2021-06-19 */ - public static function getCalAdressesAllFromContact( CalendarComponent $component ) : array + public static function getCalAdressesAllFromContact( CalendarComponent|Vevent $component ) : array { $output = []; foreach( $component->getAllContact( true ) as $propValue ) { diff --git a/vendor/kigkonsult/icalcreator/src/Util/DateIntervalFactory.php b/vendor/kigkonsult/icalcreator/src/Util/DateIntervalFactory.php index 5a12f73..8599d94 100644 --- a/vendor/kigkonsult/icalcreator/src/Util/DateIntervalFactory.php +++ b/vendor/kigkonsult/icalcreator/src/Util/DateIntervalFactory.php @@ -279,27 +279,20 @@ public static function dateInterval2String( * @param DateInterval $dateInterval * @return DateInterval * @throws Exception on DateInterval create error - * @since 2.27.14 - 2019-03-09 + * @since 2.41.78 - 2023-06-27 */ public static function conformDateInterval( DateInterval $dateInterval ) : DateInterval { - $dateIntervalArr = (array) $dateInterval; - if( 60 <= $dateIntervalArr[self::$s] ) { - $dateIntervalArr[self::$i] += - (int) floor( $dateIntervalArr[self::$s] / 60 ); - $dateIntervalArr[self::$s] %= 60; - } - if( 60 <= $dateIntervalArr[self::$i] ) { - $dateIntervalArr[self::$h] += - (int) floor( $dateIntervalArr[self::$i] / 60 ); - $dateIntervalArr[self::$i] %= 60; - } - if( 24 <= $dateIntervalArr[self::$h] ) { - $dateIntervalArr[self::$d] += - (int) floor( $dateIntervalArr[self::$h] / 24 ); - $dateIntervalArr[self::$h] %= 24; + $ZERO = '@0'; + $DAYS = 'days'; + $base = new DateTime( $ZERO ); + $target = new DateTime( $ZERO ); + $target->add( $dateInterval ); + $output = $base->diff( $target ); + if( property_exists( $output, $DAYS )) { + $output->days = false; } - return self::DateIntervalArr2DateInterval( $dateIntervalArr ); + return $output; } /** diff --git a/vendor/kigkonsult/icalcreator/src/Util/DateTimeFactory.php b/vendor/kigkonsult/icalcreator/src/Util/DateTimeFactory.php index f6588db..e75b0f9 100644 --- a/vendor/kigkonsult/icalcreator/src/Util/DateTimeFactory.php +++ b/vendor/kigkonsult/icalcreator/src/Util/DateTimeFactory.php @@ -176,6 +176,9 @@ public static function setDate( Pc $value, ? bool $forceUTC = false ) : Pc { $isValueDate = $value->hasParamValue( IcalInterface::DATE ); $paramTZid = self::getParamTZid( $value ); + if( DateTimeZoneFactory::isUtcTz( $paramTZid )) { + $paramTZid = IcalInterface::UTC; + } $isLocalTime = $value->hasParamKey( IcalInterface::ISLOCALTIME ); switch( true ) { case ( $value->value instanceof DateTimeInterface ) : @@ -223,6 +226,7 @@ public static function setDate( Pc $value, ? bool $forceUTC = false ) : Pc * * @param Pc $pc property content * @return string + * @throws Exception * @since 2.47.68 2022-09-25 */ private static function getParamTZid( Pc $pc ) : string @@ -284,7 +288,7 @@ public static function conformDateTime( * @return DateTime * @throws Exception * @throws InvalidArgumentException - * @since 2.29.1 - 2019-06-26 + * @since 2.41.76 - 2023-05-02 */ public static function conformStringDate( string $input, @@ -545,9 +549,11 @@ public static function assertDatesAreInSequence( * @return DateTime * @throws Exception * @throws InvalidArgumentException - * @throws Exception * @since 2.41.73 - 2023-03-15 */ + /** + * @throws Exception + */ private static function getDateTimeFromDateString( string $dateString, ? string $tz diff --git a/vendor/kigkonsult/icalcreator/src/Util/DateTimeZoneFactory.php b/vendor/kigkonsult/icalcreator/src/Util/DateTimeZoneFactory.php index ccc5b99..0ba2a62 100644 --- a/vendor/kigkonsult/icalcreator/src/Util/DateTimeZoneFactory.php +++ b/vendor/kigkonsult/icalcreator/src/Util/DateTimeZoneFactory.php @@ -35,8 +35,8 @@ use IntlTimeZone; use InvalidArgumentException; use Kigkonsult\Icalcreator\IcalInterface; +use RuntimeException; -use function _PHPStan_3bfe2e67c\RingCentral\Psr7\str; use function ctype_digit; use function floor; use function in_array; @@ -57,9 +57,23 @@ class DateTimeZoneFactory { /** + * UTC variants, 'Z' first !! + * * @var string[] */ - public static array $UTCARR = [ IcalInterface::Z, IcalInterface::UTC, IcalInterface::GMT ]; + public static array $UTCARR = [ + IcalInterface::Z, + 'Etc/GMT', + 'Etc/GMT+0', + 'Etc/GMT-0', + 'Etc/GMT0', + 'Etc/Greenwich', + 'Etc/UCT', + 'Etc/Universal', + 'Etc/Zulu', + IcalInterface::GMT, + IcalInterface::UTC + ]; /** * @param string $tzString @@ -73,10 +87,10 @@ public static function isUtcTz( string $tzString ) : bool /** * Return new DateTimeZone object instance * - * @param string $tzString + * @param string $tzString * @param null|string $ymdHisString * @return DateTimeZone - * @throws InvalidArgumentException + * @throws InvalidArgumentException|Exception * @since 2.41.70 - 2022-10-19 */ public static function factory( string $tzString, ? string $ymdHisString = null ) : DateTimeZone @@ -85,12 +99,12 @@ public static function factory( string $tzString, ? string $ymdHisString = null } /** - * Assert DateTimeZoneString + * Assert DateTimeZoneString, return DateTimeZone * - * @param string $tzString + * @param string $tzString * @param null|string $ymdHisString * @return DateTimeZone - * @throws InvalidArgumentException + * @throws InvalidArgumentException|Exception * @since 2.41.70 - 2022-10-19 */ public static function assertDateTimeZone( string $tzString, ? string $ymdHisString = null ) : DateTimeZone @@ -141,7 +155,7 @@ public static function assertDateTimeZone( string $tzString, ? string $ymdHisStr * @param null|int $from * @param null|int $to * @return array - * @throws InvalidArgumentException + * @throws InvalidArgumentException|Exception * @since 2.27.8 - 2019-01-22 */ public static function getDateTimeZoneTransitions( @@ -193,7 +207,7 @@ public static function getTimeZoneNameFromOffset( string $offset ) : string * * @param string $dateString * @return string -0 */ + */ public static function getOffset( string $dateString ) : string { $dateString = trim( $dateString ); @@ -258,7 +272,7 @@ public static function hasOffset( string $string ) : bool * @param null|string $timeZoneString * @param null|string $dateTimeString A date/time string * @return bool - * @throws Exception + * @throws RuntimeException|Exception * @since 2.41.73 - 2023-03-15 * @todo SPl Exception?? */ @@ -283,7 +297,7 @@ public static function isUTCtimeZone( try { $tz = new DateTimeZone( $timeZoneString ); if( 0 !== strcasecmp( $timeZoneString, $tz->getName() )) { - throw new Exception(); // ms timezone still accepted!! + throw new RuntimeException(); // ms timezone still accepted!! } } catch( Exception ) { diff --git a/vendor/kigkonsult/icalcreator/src/Util/IcalXMLFactory.php b/vendor/kigkonsult/icalcreator/src/Util/IcalXMLFactory.php deleted file mode 100644 index ab86c23..0000000 --- a/vendor/kigkonsult/icalcreator/src/Util/IcalXMLFactory.php +++ /dev/null @@ -1,1547 +0,0 @@ - - * @copyright 2007-2023 Kjell-Inge Gustafsson, kigkonsult AB, All rights reserved - * @link https://kigkonsult.se - * @license Subject matter of licence is the software iCalcreator. - * The above copyright, link, package and version notices, - * this licence notice and the invariant [rfc5545] PRODID result use - * as implemented and invoked in iCalcreator shall be included in - * all copies or substantial portions of the iCalcreator. - * - * iCalcreator is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of - * the License, or (at your option) any later version. - * - * iCalcreator is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with iCalcreator. If not, see . - */ -declare( strict_types = 1 ); -namespace Kigkonsult\Icalcreator\Util; - -use DateInterval; -use DateTime; -use Exception; -use InvalidArgumentException; -use Kigkonsult\Icalcreator\CalendarComponent; -use Kigkonsult\Icalcreator\IcalInterface; -use Kigkonsult\Icalcreator\Pc; -use Kigkonsult\Icalcreator\Vcalendar; -use SimpleXMLElement; - -use function array_change_key_case; -use function html_entity_decode; -use function htmlspecialchars; -use function implode; -use function in_array; -use function is_array; -use function number_format; -use function sprintf; -use function str_replace; -use function str_starts_with; -use function strcasecmp; -use function stripos; -use function strlen; -use function strstr; -use function strtolower; -use function strtoupper; -use function substr; -use function trim; -use function ucfirst; - -/** - * iCalcreator XML (rfc6321) support class - * - * @deprecated - * @since 2.41.63 2022-09-05 - */ -class IcalXMLFactory -{ - /** - * @var string - */ - private static string $Vcalendar = 'vcalendar'; - - /** - * @var string[] - */ - private static array $calProps = [ - IcalInterface::VERSION, - IcalInterface::PRODID, - IcalInterface::CALSCALE, - IcalInterface::METHOD, - ]; - - /** - * @var string[] - */ - private static array $calPropsrfc7986Single = [ - IcalInterface::UID, - IcalInterface::LAST_MODIFIED, - IcalInterface::URL, - IcalInterface::REFRESH_INTERVAL, - IcalInterface::SOURCE, - IcalInterface::COLOR - ]; - - /** - * @var string[] - */ - private static array $calPropsrfc7986Multi = [ - IcalInterface::NAME, - IcalInterface::DESCRIPTION, - IcalInterface::CATEGORIES, - IcalInterface::IMAGE - ]; - - /** - * @var string - */ - private static string $properties = 'properties'; - - /** - * @var string - */ - private static string $PARAMETERS = 'parameters'; - - /** - * @var string - */ - private static string $components = 'components'; - - - /** - * @var string - */ - private static string $text = 'text'; - - /** - * @var string - */ - private static string $binary = 'binary'; - - /** - * @var string - */ - private static string $uri = 'uri'; - - /** - * @var string - */ - private static string $date = 'date'; - - /** - * @var string - */ - private static string $date_time = 'date-time'; - - /** - * @var string - */ - private static string $period = 'period'; - - /** - * @var string - */ - private static string $rstatus = 'rstatus'; - - /** - * @var string - */ - private static string $unknown = 'unknown'; - - /** - * @var string - */ - private static string $recur = 'recur'; - - /** - * @var string - */ - private static string $cal_address = 'cal-address'; - - /** - * @var string - */ - private static string $integer = 'integer'; - - /** - * @var string - */ - private static string $utc_offset = 'utc-offset'; - - /** - * @var string - */ - private static string $code = 'code'; - - /** - * @var string - */ - private static string $description = 'description'; - - /** - * @var string - */ - private static string $data = 'data'; - - /** - * @var string - */ - private static string $time = 'time'; - - /** - * @var string - */ - private static string $bysecond = 'bysecond'; - - /** - * @var string - */ - private static string $byminute = 'byminute'; - - /** - * @var string - */ - private static string $byhour = 'byhour'; - - /** - * @var string - */ - private static string $bymonthday = 'bymonthday'; - - /** - * @var string - */ - private static string $byyearday = 'byyearday'; - - /** - * @var string - */ - private static string $byweekno = 'byweekno'; - - /** - * @var string - */ - private static string $bymonth = 'bymonth'; - - /** - * @var string - */ - private static string $bysetpos = 'bysetpos'; - - /** - * @var string - */ - private static string $byday = 'byday'; - - /** - * @var string - */ - private static string $freq = 'freq'; - - /** - * @var string - */ - private static string $count = 'count'; - - /** - * @var string - */ - private static string $interval = 'interval'; - - /** - * @var string - */ - private static string $wkst = 'wkst'; - - /** - * @var string - */ - public static string $XMLstart = - ''; - - /** - * Return iCal XML (rfc6321) output, using PHP SimpleXMLElement - * - * @param Vcalendar $calendar iCalcreator Vcalendar instance reference - * @return bool|string - * @throws Exception - * @throws InvalidArgumentException - * @since 2.41.51 2022-08-09 - */ - public static function iCal2XML( Vcalendar $calendar ) : bool | string - { - static $YMDTHISZ = 'Ymd\THis\Z'; - /** fix an SimpleXMLElement instance and create root element */ - $xml = new SimpleXMLElement( - sprintf( self::$XMLstart, ICALCREATOR_VERSION, gmdate( $YMDTHISZ )) - ); - $VcalendarXml = $xml->addChild( self::$Vcalendar ); - $langCal = $calendar->getConfig( IcalInterface::LANGUAGE ); - /** fix calendar properties */ - $properties = $VcalendarXml->addChild( self::$properties ); - foreach( self::$calProps as $propName ) { - $method = StringFactory::getGetMethodName( $propName ); - if( false !== ( $contents = $calendar->{$method}())) { - self::addXMLchildText( $properties, $propName, Pc::factory( $contents )); - } - } // end foreach - foreach( self::$calPropsrfc7986Single as $propName ) { - $method = StringFactory::getGetMethodName( $propName ); - switch( strtoupper( $propName )) { - case IcalInterface::UID : // fall through - case IcalInterface::COLOR : - if( false !== ( $contents = $calendar->{$method}( true ))) { - self::addXMLchildText( $properties, $propName, $contents ); - } - break; - case IcalInterface::LAST_MODIFIED : - if( false !== ( $contents = $calendar->{$method}( true ))) { - unset( $contents->params[IcalInterface::VALUE] ); - self::addXMLchildDateTime( $properties, $propName, $contents ); - } - break; - case IcalInterface::SOURCE : // fall through - case IcalInterface::URL : - if( false !== ( $contents = $calendar->{$method}( true ))) { - self::addXMLchildUri( $properties, $propName, $contents ); - } - break; - case IcalInterface::REFRESH_INTERVAL : - if( false !== ( $contents = $calendar->{$method}( true ))) { - self::addXMLchildDuration( $properties, $propName, $contents ); - } - break; - } // end switch - } // end foreach - foreach( self::$calPropsrfc7986Multi as $propName ) { - $method = StringFactory::getGetAllMethodName( $propName ); - switch( strtoupper( $propName )) { - case IcalInterface::CATEGORIES : // fall through - case IcalInterface::DESCRIPTION : // fall through - case IcalInterface::NAME : - foreach( $calendar->{$method}( true ) as $contents ) { - if( ! empty( $langCal )) { - $contents->addParam( IcalInterface::LANGUAGE, $langCal, false ); - } - self::addXMLchildText( $properties, $propName, $contents ); - } // end while - break; - case IcalInterface::IMAGE : - foreach( $calendar->{$method}( true ) as $contents ) { - self::addXMLchildBinaryUri( $properties, $propName, $contents ); - } // end while - break; - } // end switch - } // end foreach - foreach( $calendar->getAllXprop( true ) as $contents ) { - self::addXMLchild( $properties, $contents[0], self::$unknown, $contents[1] ); - } // end while - /** prepare to fix components with properties/subComponents */ - $componentsXml = $VcalendarXml->addChild( self::$components ); - /** fix component properties */ - foreach( $calendar->getComponents() as $component ) { - self::compProps2Xml( - $component, - $componentsXml->addChild( strtolower( $component->getCompType())), - $langCal - ); - } // end while - return $xml->asXML(); - } - - /** - * Parse component into XML - * - * @param CalendarComponent $component - * @param SimpleXMLElement $parentXml - * @param bool|string $langCal - * @throws Exception - * @since 2.41.51 2022-08-09 - */ - private static function compProps2Xml( - CalendarComponent $component, - SimpleXMLElement $parentXml, - bool | string $langCal - ) : void - { - $compName = $component->getCompType(); - $properties = $parentXml->addChild( self::$properties ); - $langComp = $component->getConfig( IcalInterface::LANGUAGE ); - $props = $component->getConfig( IcalInterface::SETPROPERTYNAMES ); - foreach( $props as $propName ) { - $method = Vcalendar::isMultiProp( $propName ) - ? StringFactory::getGetAllMethodName( $propName ) - : StringFactory::getGetMethodName( $propName ); - switch( strtoupper( $propName )) { - case IcalInterface::ATTACH : // may occur multiple times - case IcalInterface::IMAGE : - foreach( $component->{$method}( true ) as $contents ) { - self::addXMLchildBinaryUri( $properties, $propName, $contents ); - } // end while - break; - case IcalInterface::ATTENDEE : - foreach( $component->{$method}( true ) as $contents ) { - if( $langCal && $contents->hasParamKey( IcalInterface::CN )) { - self::addLanguage( $contents->params, $langComp, $langCal ); - } - self::addXMLchildCalAddress( $properties, $propName, $contents ); - } // end foreach - break; - case IcalInterface::EXDATE : - foreach( $component->{$method}( true ) as $contents ) { - $isDateSet = $contents->hasParamValue( IcalInterface::DATE ); - $contents->removeParam( IcalInterface::VALUE ); - if( $isDateSet ) { - self::addXMLchildDate( $properties, $propName, $contents ); - } - else { - self::addXMLchildDateTime( $properties, $propName, $contents ); - } - } // end foreach - break; - case IcalInterface::FREEBUSY : - foreach( $component->{$method}( true ) as $contents ) { - self::addXMLchild( $properties, $propName, self::$period, $contents ); - } // end foreach - break; - case IcalInterface::REQUEST_STATUS : - foreach( $component->{$method}( true ) as $contents ) { - self::addLanguage( $contents->params, $langComp, $langCal ); - self::addXMLchild( $properties, $propName, self::$rstatus, $contents ); - } // end foreach - break; - case IcalInterface::RDATE : - foreach( $component->{$method}( true ) as $contents ) { - $type = self::$date_time; - if( $contents->hasParamKey( IcalInterface::VALUE, IcalInterface::DATE )) { - $type = self::$date; - } - elseif( $contents->hasParamKey( IcalInterface::VALUE, IcalInterface::PERIOD )) { - $type = self::$period; - } // end if - $contents->removeParam( IcalInterface::VALUE ); - self::addXMLchild( $properties, $propName, $type, $contents ); - } // end foreach - break; - case IcalInterface::DESCRIPTION : // multiple in VCALENDAR/VJOURNAL, single elsewere - // fall through - case IcalInterface::LOCATION : // multiple in PARTICIPANT, single elsewere - foreach( $component->{$method}( true ) as $contents ) { - self::addLanguage( $contents->params, $langComp, $langCal ); - self::addXMLchildText( $properties, $propName, $contents ); - if(( IcalInterface::DESCRIPTION === $propName ) && - $component::isDescriptionSingleProp( $compName )) { - break; - } - if(( IcalInterface::LOCATION === $propName ) && - $component::isLocationSingleProp( $compName )) { - break; - } - } // end foreach - break; - case IcalInterface::STYLED_DESCRIPTION : - foreach( $component->{$method}( true ) as $contents ) { - if( $contents->hasParamValue( IcalInterface::URI )) { - self::addXMLchildUri( $properties, $propName, $contents ); - } - else { - self::addLanguage( $contents->params, $langComp, $langCal ); - self::addXMLchildText( $properties, $propName, $contents ); - } - } // end foreach - break; - case IcalInterface::CATEGORIES : // fall through - case IcalInterface::COMMENT : // fall through - case IcalInterface::CONTACT : // fall through // single in VFREEBUSY, multiple elsewere - case IcalInterface::NAME : // dito, multi i Vcalendar, single in Vlocation/Vresource (here) - case IcalInterface::RELATED_TO : // fall through - case IcalInterface::TZID_ALIAS_OF : // fall through - case IcalInterface::TZNAME : // fall through - case IcalInterface::RESOURCES : - foreach( $component->{$method}( true ) as $contents ) { - if(( IcalInterface::RELATED_TO !== $propName )) { - self::addLanguage( $contents->params, $langComp, $langCal ); - } // end if - self::addXMLchildText( $properties, $propName, $contents ); - if(( IcalInterface::CONTACT === $propName ) && $component::isContactSingleProp( $compName )) { - break; - } - if( IcalInterface::NAME === $propName ) { - break; - } - } // end foreach - break; - case IcalInterface::ACKNOWLEDGED : // fall through - case IcalInterface::CREATED : // fall through - case IcalInterface::COMPLETED : // fall through - case IcalInterface::DTSTAMP : // fall through - case IcalInterface::LAST_MODIFIED : // fall through - case IcalInterface::DTSTART : // fall through - case IcalInterface::DTEND : // fall through - case IcalInterface::DUE : // fall through - case IcalInterface::RECURRENCE_ID : // fall through - case IcalInterface::TZUNTIL : // fall through - if( false !== ( $contents = $component->{$method}( true ))) { - $sDateSet = $contents->hasParamValue( IcalInterface::DATE ); - $contents->removeParam( IcalInterface::VALUE ); - if( $sDateSet ) { - self::addXMLchildDate( $properties, $propName, $contents ); - } - else { - self::addXMLchildDateTime( $properties, $propName, $contents ); - } - } // end if - break; - case IcalInterface::DURATION : - if( false !== ( $contents = $component->{$method}( true ))) { - self::addXMLchildDuration( $properties, $propName, $contents ); - } - break; - case IcalInterface::EXRULE : - case IcalInterface::RRULE : - if( false !== ( $contents = $component->{$method}( true ))) { - self::addXMLchildRecur( $properties, $propName, $contents ); - } - break; - case IcalInterface::ACTION : // fall through - case IcalInterface::BUSYTYPE : // dito - case IcalInterface::KLASS : // fall through - case IcalInterface::COLOR : // fall through - case IcalInterface::LOCATION_TYPE : // dito - case IcalInterface::PROXIMITY : // fall through - case IcalInterface::PARTICIPANT_TYPE : // dito - case IcalInterface::RESOURCE_TYPE : // dito - case IcalInterface::STATUS : // fall through - case IcalInterface::SUMMARY : // fall through - case IcalInterface::TRANSP : // fall through - case IcalInterface::TZID : // fall through - case IcalInterface::UID : - static $locNameSum = [ IcalInterface::LOCATION_TYPE, IcalInterface::NAME, IcalInterface::SUMMARY ]; - if( false !== ( $contents = $component->{$method}( true ))) { - if( in_array( $propName, $locNameSum,true )) { - self::addLanguage( $contents->params, $langComp, $langCal ); - } - self::addXMLchildText( $properties, $propName, $contents ); - } - break; - case IcalInterface::GEO : - if( false !== ( $contents = $component->{$method}( true ))) { - self::addXMLchild( $properties, $propName, strtolower( IcalInterface::GEO ), $contents ); - } - break; - case IcalInterface::CALENDAR_ADDRESS : // fall through - case IcalInterface::ORGANIZER : - if( false !== ( $contents = $component->{$method}( true ))) { - if(( IcalInterface::ORGANIZER === $propName ) && - $contents->hasParamKey( IcalInterface::CN )) { - self::addLanguage( $contents->params, $langComp, $langCal ); - } - self::addXMLchildCalAddress( $properties, $propName, $contents ); - } - break; - case IcalInterface::PERCENT_COMPLETE : // fall through - case IcalInterface::PRIORITY : // fall through - case IcalInterface::REPEAT : // fall through - case IcalInterface::SEQUENCE : - if( false !== ( $contents = $component->{$method}( true ))) { - self::addXMLchildInteger( $properties, $propName, $contents ); - } - break; - case IcalInterface::STRUCTURED_DATA : - foreach( $component->{$method}( true ) as $contents ) { - if( $contents->hasParamValue( IcalInterface::TEXT )) { - self::addXMLchildText( $properties, $propName, $contents ); - } - else { - self::addXMLchildBinaryUri( $properties, $propName, $contents ); - } - } // end foreach - break; - case IcalInterface::CONFERENCE : - foreach( $component->{$method}( true ) as $contents ) { - self::addXMLchildUri( $properties, $propName, $contents ); - } // end foreach - break; - case IcalInterface::TRIGGER : - if( false !== ( $contents = $component->{$method}( true ))) { - if( $contents->value instanceof DateInterval ) { - self::addXMLchildDuration( $properties, $propName, $contents ); - } - else { - self::addXMLchildDateTime( $properties, $propName, $contents ); - } - } // end if - break; - case IcalInterface::TZOFFSETFROM : // fall through - case IcalInterface::TZOFFSETTO : - if( false !== ( $contents = $component->{$method}( true ))) { - self::addXMLchild( $properties, $propName, self::$utc_offset, $contents ); - } - break; - case IcalInterface::TZURL : // fall through - case IcalInterface::URL : - $method = StringFactory::getGetMethodName( $propName ); - if( false !== ( $contents = $component->{$method}( true ))) { - self::addXMLchildUri( $properties, $propName, $contents ); - } - break; - default : - if( ! StringFactory::isXprefixed( $propName )) { - break; - } - if( false !== ( $contents = $component->getXprop( $propName, null, true ))) { - self::addXMLchild( $properties, $contents[0], self::$unknown, $contents[1] ); - } - break; - } // end switch( $propName ) - } // end foreach( $props as $pix => $propName ) - /** fix subComponent properties, if any */ - foreach( $component->getComponents() as $subComp ) { - self::compProps2Xml( - $subComp, - $parentXml->addChild( strtolower( $subComp->getCompType())), - $langCal - ); - } - } - - /** - * Add parameter language if not set - * - * @param string[] $params - * @param bool|string $langComp - * @param bool|string $langCal - * @return void - */ - private static function addLanguage( array & $params, bool | string $langComp, bool | string $langCal ) : void - { - switch( true ) { - case isset( $params[IcalInterface::LANGUAGE] ) : - break; - case ( ! empty( $langComp )) : - $params[IcalInterface::LANGUAGE] = $langComp; - break; - case ( ! empty( $langCal )) : - $params[IcalInterface::LANGUAGE] = $langCal; - break; - } // end switch - } - - /** - * Add XML (rfc6321) binary/uri children to a SimpleXMLelement - * - * @param SimpleXMLElement $parent a SimpleXMLelement class instance - * @param string $name new element node name - * @param Pc $contents - * @return void - * @throws Exception - * @throws InvalidArgumentException - * @since 2.41.36 2022-03-30 - */ - private static function addXMLchildBinaryUri( SimpleXMLElement $parent, string $name, Pc $contents ) : void - { - $type = $contents->hasParamValue( IcalInterface::BINARY ) - ? self::$binary - : self::$uri; - $contents->removeParam( IcalInterface::VALUE ); - self::addXMLchild( $parent, $name, $type, $contents ); - } - - /** - * Add XML (rfc6321) cal-address children to a SimpleXMLelement - * - * @param SimpleXMLElement $parent a SimpleXMLelement class instance - * @param string $name new element node name - * @param Pc $contents new subelement contents - * @return void - * @throws Exception - * @throws InvalidArgumentException - * @since 2.41.36 2022-03-30 - */ - private static function addXMLchildCalAddress( SimpleXMLElement $parent, string $name, Pc $contents ) : void - { - self::addXMLchild( $parent, $name, self::$cal_address, $contents ); - } - - /** - * Add XML (rfc6321) date children to a SimpleXMLelement - * - * @param SimpleXMLElement $parent a SimpleXMLelement class instance - * @param string $name new element node name - * @param Pc $contents new subelement contents - * @return void - * @throws Exception - * @throws InvalidArgumentException - * @since 2.41.36 2022-03-30 - */ - private static function addXMLchildDate( SimpleXMLElement $parent, string $name, Pc $contents ) : void - { - self::addXMLchild( $parent, $name, self::$date, $contents ); - } - - /** - * Add XML (rfc6321) date-time children to a SimpleXMLelement - * - * @param SimpleXMLElement $parent a SimpleXMLelement class instance - * @param string $name new element node name - * @param Pc $contents new subelement contents - * @return void - * @throws Exception - * @throws InvalidArgumentException - * @since 2.41.36 2022-03-30 - */ - private static function addXMLchildDateTime( SimpleXMLElement $parent, string $name, Pc $contents ) : void - { - self::addXMLchild( $parent, $name, self::$date_time, $contents ); - } - - /** - * Add XML (rfc6321) duration children to a SimpleXMLelement - * - * @param SimpleXMLElement $parent a SimpleXMLelement class instance - * @param string $name new element node name - * @param Pc $contents new subelement contents - * @return void - * @throws Exception - * @throws InvalidArgumentException - * @since 2.41.36 2022-03-30 - */ - private static function addXMLchildDuration( SimpleXMLElement $parent, string $name, Pc $contents ) : void - { - self::addXMLchild( $parent, $name, strtolower( IcalInterface::DURATION ), $contents ); - } - - /** - * Add XML (rfc6321) integer children to a SimpleXMLelement - * - * @param SimpleXMLElement $parent a SimpleXMLelement class instance - * @param string $name new element node name - * @param Pc $contents new subelement contents - * @return void - * @throws Exception - * @throws InvalidArgumentException - * @since 2.41.36 2022-03-30 - */ - private static function addXMLchildInteger( SimpleXMLElement $parent, string $name, Pc $contents ) : void - { - self::addXMLchild( $parent, $name, self::$integer, $contents ); - } - - /** - * Add XML (rfc6321) recur children to a SimpleXMLelement - * - * @param SimpleXMLElement $parent a SimpleXMLelement class instance - * @param string $name new element node name - * @param Pc $contents new subelement contents - * @return void - * @throws Exception - * @throws InvalidArgumentException - * @since 2.41.36 2022-03-30 - */ - private static function addXMLchildRecur( SimpleXMLElement $parent, string $name, Pc $contents ) : void - { - self::addXMLchild( $parent, $name, self::$recur, $contents ); - } - - /** - * Add XML (rfc6321) text children to a SimpleXMLelement - * - * @param SimpleXMLElement $parent a SimpleXMLelement class instance - * @param string $name new element node name - * @param Pc $contents new subelement contents - * @return void - * @throws Exception - * @since 2.41.36 2022-03-30 - */ - private static function addXMLchildText( SimpleXMLElement $parent, string $name, Pc $contents ) : void - { - self::addXMLchild( $parent, $name, self::$text, $contents ); - } - - /** - * Add XML (rfc6321) uri children to a SimpleXMLelement - * - * @param SimpleXMLElement $parent a SimpleXMLelement class instance - * @param string $name new element node name - * @param Pc $contents new subelement contents - * @return void - * @throws Exception - * @throws InvalidArgumentException - * @since 2.41.36 2022-03-30 - */ - private static function addXMLchildUri( SimpleXMLElement $parent, string $name, Pc $contents ) : void - { - $contents->value = htmlentities( $contents->value ); - self::addXMLchild( $parent, $name, self::$uri, $contents ); - } - - /** - * Add XML (rfc6321) children to a SimpleXMLelement - * - * @param SimpleXMLElement $parent a SimpleXMLelement class instance - * @param string $name new element node name - * @param string $type content type, subelement(-s) name - * @param Pc $subData new subelement value and 'attributes' - * @return void - * @throws Exception - * @throws InvalidArgumentException - * @since 2.41.63 2022-09-05 - */ - private static function addXMLchild( - SimpleXMLElement $parent, - string $name, - string $type, - Pc $subData - ) : void - { - static $BOOLEAN = 'boolean'; - static $UNTIL = 'until'; - static $START = 'start'; - static $END = 'end'; - static $SP0 = ''; - static $altrep = 'altrep'; - static $dir = 'dir'; - static $delegated_from = 'delegated-from'; - static $delegated_to = 'delegated-to'; - static $member = 'member'; - static $order = 'order'; - static $sent_by = 'sent-by'; - static $rsvp = 'rsvp'; - static $derived = 'derived'; - /** create new child node */ - $name = strtolower( $name ); - $child = $parent->addChild( $name ); - if( empty( $subData->value ) && ( Util::$ZERO !== (string) $subData->value )) { - $child->addChild( $type ); - return; - } - $recurDateIsSet = false; - $isLocalTime = $subData->hasParamKey(IcalInterface::ISLOCALTIME ); - $isOneParm = ( 1 === count( $subData->params )); - switch( true ) { - case ( empty( $subData->params ) || ( $isOneParm && $isLocalTime )) : - break; - case ( self::$recur === $type ) : - $recurDateIsSet = $subData->hasParamValue( IcalInterface::DATE ); - if( $isOneParm && $subData->hasParamKey( IcalInterface::VALUE )) { - break; - } - $subData->removeParam( IcalInterface::VALUE ); - // fall through - default : - $parameters = $child->addChild( self::$PARAMETERS ); - foreach( $subData->getParams() as $pKey => $parVal ) { - if( IcalInterface::VALUE === $pKey ) { - if( str_contains( $parVal, Util::$COLON )) { - $p1 = $parameters->addChild( strtolower( $pKey )); - $p1->addChild( self::$unknown, htmlspecialchars( $parVal )); - $type = strtolower( strstr( $parVal, Util::$COLON, true )); - } - elseif( 0 !== strcasecmp( $type, $parVal )) { - $type = strtolower( $parVal ); - } - continue; - } // end if VALUE - if( IcalInterface::ISLOCALTIME === $pKey ) { - continue; - } - $pKey = strtolower( $pKey ); - if( StringFactory::isXprefixed( $pKey )) { - $p1 = $parameters->addChild( $pKey ); - $p1->addChild( self::$unknown, htmlspecialchars( $parVal )); - continue; - } - $p1 = $parameters->addChild( $pKey ); - $ptype = match ( $pKey ) { - $altrep, $dir => self::$uri, - $delegated_from, $delegated_to, $member, $sent_by => self::$cal_address, - $order => self::$integer, - $rsvp, $derived => $BOOLEAN, - default => self::$text, - }; // end switch - if( is_array( $parVal )) { - foreach( $parVal as $pV ) { - $p1->addChild( $ptype, htmlspecialchars((string) $pV )); - } - } - else { - $p1->addChild( $ptype, htmlspecialchars((string) $parVal )); - } - } // end foreach $params - break; - } // end switch - /** store content on type */ - $value = $subData->value; - switch( $type ) { - case self::$binary : - $child->addChild( $type, $value ); - break; - case $BOOLEAN : - break; - case self::$cal_address : - $child->addChild( $type, $value ); - break; - case self::$date : - if( $value instanceof DateTime ) { - $value = [ $value ]; - } - foreach( $value as $date ) { - $child->addChild( $type, DateTimeFactory::dateTime2Str( $date, true )); - } - break; - case self::$date_time : - if( $value instanceof DateTime ) { - $value = [ $value ]; - } - foreach( $value as $dt ) { - $child->addChild( $type, DateTimeFactory::dateTime2Str( $dt, false, $isLocalTime )); - } // end foreach - break; - case strtolower( IcalInterface::DURATION ) : - $child->addChild( - $type, - DateIntervalFactory::dateInterval2String( $value, true ) - ); - break; - case strtolower( IcalInterface::GEO ) : - if( ! empty( $value )) { - $child->addChild( - IcalInterface::LATITUDE, - GeoFactory::geo2str2( $value[IcalInterface::LATITUDE], GeoFactory::$geoLatFmt ) - ); - $child->addChild( - IcalInterface::LONGITUDE, - GeoFactory::geo2str2( $value[IcalInterface::LONGITUDE], GeoFactory::$geoLongFmt ) - ); - } - break; - case self::$integer : - $child->addChild( $type, (string) $value ); - break; - case self::$period : - if( ! is_array( $value )) { - break; - } - foreach( $value as $period ) { - $v1 = $child->addChild( $type ); - $str = DateTimeFactory::dateTime2Str( $period[0], false, $isLocalTime ); - $v1->addChild( $START, $str ); - if( $period[1] instanceof DateInterval ) { - $v1->addChild( - strtolower( IcalInterface::DURATION ), - DateIntervalFactory::dateInterval2String( $period[1] ) - ); - } - elseif( $period[1] instanceof DateTime ) { - $str = DateTimeFactory::dateTime2Str( $period[1], false, $isLocalTime ); - $v1->addChild( $END, $str ); - } - } // end foreach - break; - case self::$recur : - $value = array_change_key_case( $value ); - foreach( $value as $ruleLabel => $ruleValue ) { - switch( $ruleLabel ) { - case $UNTIL : - $child->addChild( - $ruleLabel, - DateTimeFactory::dateTime2Str( $ruleValue, $recurDateIsSet ) - ); - break; - case self::$bysecond : - case self::$byminute : - case self::$byhour : - case self::$bymonthday : - case self::$byyearday : - case self::$byweekno : - case self::$bymonth : - case self::$bysetpos : - if( is_array( $ruleValue )) { - foreach( $ruleValue as $valuePart ) { - $child->addChild( $ruleLabel, (string) $valuePart ); - } - } - else { - $child->addChild( $ruleLabel, $ruleValue ); - } - break; - case self::$byday : - if( isset( $ruleValue[IcalInterface::DAY] )) { - $str = $ruleValue[0] ?? Util::$SP0; - $str .= $ruleValue[IcalInterface::DAY]; - $child->addChild( $ruleLabel, $str ); - } - else { - foreach( $ruleValue as $valuePart ) { - if( isset( $valuePart[IcalInterface::DAY] )) { - $str = $valuePart[0] ?? Util::$SP0; - $str .= $valuePart[IcalInterface::DAY]; - $child->addChild( $ruleLabel, $str ); - } - else { - $child->addChild( $ruleLabel, $valuePart ); - } - } // end foreach - } - break; - case self::$freq : - case self::$count : - case self::$interval : - case self::$wkst : - default: - $child->addChild( $ruleLabel, (string) $ruleValue ); - break; - } // end switch( $ruleLabel ) - } // end foreach( $value as $ruleLabel => $ruleValue ) - break; - case self::$rstatus : - $child->addChild( - self::$code, - number_format((float) $value[IcalInterface::STATCODE], 2, Util::$DOT, $SP0 ) - ); - $child->addChild( - self::$description, - htmlspecialchars( $value[IcalInterface::STATDESC] ) - ); - if( isset( $value[IcalInterface::EXTDATA] )) { - $child->addChild( - self::$data, - htmlspecialchars( $value[IcalInterface::EXTDATA] ) - ); - } - break; - case self::$text : - if( ! is_array( $value )) { - $value = [ $value ]; - } - foreach( $value as $part ) { - $child->addChild( $type, htmlspecialchars( $part )); - } - break; - case self::$time : - break; - case self::$uri : - $child->addChild( $type, $value ); - break; - case self::$utc_offset : - if( DateIntervalFactory::hasPlusMinusPrefix( $value )) { - $str = $value[0]; - $value = substr( $value, 1 ); - } - else { - $str = Util::$PLUS; - } - $str .= substr( $value, 0, 2 ) . - Util::$COLON . substr( $value, 2, 2 ); - if( 4 < strlen( $value )) { - $str .= Util::$COLON . substr( $value, 4 ); - } - $child->addChild( $type, $str ); - break; - case self::$unknown : // fall through - default: - if( is_array( $value )) { - $value = implode( $value ); - } - $child->addChild( self::$unknown, htmlspecialchars( $value )); - break; - } // end switch - } - - /** - * Parse (rfc6321) XML string into iCalcreator instance - * - * @param string $xmlStr - * @param null|string[] $iCalcfg Vcalendar config array (opt) - * @return Vcalendar|bool false on error - * @throws Exception - * @since 2.20.23 - 2017-02-25 - */ - public static function XML2iCal( string $xmlStr, ? array $iCalcfg = [] ) : Vcalendar | bool - { - static $CRLF = [ "\r\n", "\n\r", "\n", "\r" ]; - $xmlStr = str_replace( $CRLF, Util::$SP0, $xmlStr ); - $xml = self::XMLgetTagContent1( $xmlStr, self::$Vcalendar, $endIx ); - $iCal = new Vcalendar( $iCalcfg ?? [] ); - if( false === self::XMLgetComps( $iCal, $xmlStr )) { - return false; - } - return $iCal; - } - - /** - * Parse (rfc6321) XML string into iCalcreator components - * - * @param IcalInterface $iCal - * @param string $xml - * @return IcalInterface|bool false on error - * @since 2.41.54 - 2022-08-13 - */ - private static function XMLgetComps( IcalInterface $iCal, string $xml ) : IcalInterface | bool - { - static $PROPSTAGempty = ''; - static $PROPSTAGstart = ''; - static $COMPSTAGempty = ''; - static $COMPSTAGstart = ''; - static $NEW = 'new'; - static $ALLCOMPS = [ // all IcalBase::$CALCOMPS + IcalBase::$TZCOMPS - IcalInterface::AVAILABLE, - IcalInterface::DAYLIGHT, - IcalInterface::PARTICIPANT, - IcalInterface::STANDARD, - IcalInterface::VALARM, - IcalInterface::VAVAILABILITY, - IcalInterface::VEVENT, - IcalInterface::VFREEBUSY, - IcalInterface::VJOURNAL, - IcalInterface::VLOCATION, - IcalInterface::VRESOURCE, - IcalInterface::VTIMEZONE, - IcalInterface::VTODO, - ]; - $len = strlen( $xml ); - $sx = 0; - while( - ((( $sx + 12 ) < $len ) && - ! str_starts_with( substr( $xml, $sx ), $PROPSTAGstart ) && - ! str_starts_with( substr( $xml, $sx ), $COMPSTAGstart ) - ) && - ((( $sx + 13 ) < $len ) && - ! str_starts_with( substr( $xml, $sx ), $PROPSTAGempty ) && - ! str_starts_with( substr( $xml, $sx ), $COMPSTAGempty ))) { - ++$sx; - } // end while - if(( $sx + 11 ) >= $len ) { - return false; - } - if( str_starts_with( $xml, $PROPSTAGempty )) { - $pos = strlen( $PROPSTAGempty ); - $xml = substr( $xml, $pos ); - } - elseif( str_starts_with( substr( $xml, $sx ), $PROPSTAGstart )) { - $xml2 = self::XMLgetTagContent1( $xml, self::$properties, $endIx ); - self::XMLgetProps( $iCal, $xml2 ); - $xml = substr( $xml, $endIx ); - } - if( str_starts_with( $xml, $COMPSTAGempty )) { - $pos = strlen( $COMPSTAGempty ); - $xml = substr( $xml, $pos ); - } - elseif( str_starts_with( $xml, $COMPSTAGstart )) { - $xml = self::XMLgetTagContent1( $xml, self::$components, $endIx ); - } - while( ! empty( $xml )) { - $xml2 = self::XMLgetTagContent2( $xml, $tagName, $endIx ); - $compType = ucfirst( strtolower( $tagName )); - if( in_array( $compType, $ALLCOMPS, true )) { - $newCompMethod = $NEW . $compType; - $iCalComp = $iCal->{$newCompMethod}(); - self::XMLgetComps( $iCalComp, $xml2 ); - } - $xml = substr( $xml, $endIx ); - } // end while( ! empty( $xml )) - return $iCal; - } - - /** - * Parse (rfc6321) XML into iCalcreator properties - * - * @param IcalInterface $iCalComp iCalcreator calendar/component instance - * @param string $xml - * @return void - * @since 2.41.56 - 2022-08-15 - * @noinspection UnsupportedStringOffsetOperationsInspection - */ - private static function XMLgetProps( IcalInterface $iCalComp, string $xml ) : void - { - static $VERSIONPRODID = [ IcalInterface::VERSION, IcalInterface::PRODID ]; - static $PARAMENDTAG = ''; - static $PARAMTAG = ''; - static $DATETAGST = 'setXprop( $propName ); - } - else { - $method = StringFactory::getSetMethodName( $propName ); - $iCalComp->{$method}(); - } - $xml = substr( $xml, $endIx ); - continue; - } - $params = []; - if( str_starts_with( $xml2, $PARAMENDTAG )) { - $xml2 = substr( $xml2, 13 ); - } - elseif( str_starts_with( $xml2, $PARAMTAG )) { - $xml3 = self::XMLgetTagContent1( $xml2, self::$PARAMETERS, $endIx2 ); - $endIx3 = 0; - while( ! empty( $xml3 )) { - $xml4 = self::XMLgetTagContent2( $xml3, $paramKey, $endIx3 ); - $paramKey = strtoupper( $paramKey ); - if( in_array( $paramKey, $ATTENDEEPARKEYS, true )) { - while( ! empty( $xml4 )) { - $paramValue = self::XMLgetTagContent1( $xml4, self::$cal_address, $endIx4 ); - if( ! isset( $params[$paramKey] )) { - $params[$paramKey] = [ $paramValue ]; - } - else { - $params[$paramKey][] = $paramValue; - } - $xml4 = substr( $xml4, $endIx4 ); - } // end while - } // end if( in_array( $paramKey, Util::$ATTENDEEPARKEYS )) - else { - $pType = Util::$SP0; // skip parameter valueType - $paramValue = html_entity_decode( - self::XMLgetTagContent2( $xml4, $pType, $endIx4 ) - ); - if( ! isset( $params[$paramKey] )) { - $params[$paramKey] = $paramValue; - } - else { - $params[$paramKey] .= Util::$COMMA . $paramValue; - } - } - $xml3 = substr( $xml3, $endIx3 ); - } // end while - $xml2 = substr( $xml2, $endIx2 ); - } // end elseif - parameters - $valueType = Util::$SP0; - $value = ( ! empty( $xml2 ) || ( Util::$ZERO === $xml2 )) - ? self::XMLgetTagContent2( $xml2, $valueType, $endIx3 ) - : Util::$SP0; - switch( $propName ) { - case IcalInterface::URL : // fall through - case IcalInterface::TZURL : - $value = html_entity_decode( $value ); - break; - case IcalInterface::EXDATE : // multiple single-date(-times) may exist - // fall through - case IcalInterface::RDATE : - if( self::$period !== $valueType ) { - if( self::$date === $valueType ) { - $params[IcalInterface::VALUE] = IcalInterface::DATE; - } - $t = []; - while( ! empty( $xml2 ) && str_starts_with( $xml2, $DATETAGST )) { - $t[] = self::XMLgetTagContent2( $xml2, $pType, $endIx4); - $xml2 = substr( $xml2, $endIx4 ); - } // end while - $value = $t; - break; - } - // fall through - case IcalInterface::FREEBUSY : - if( IcalInterface::RDATE === $propName ) { - $params[IcalInterface::VALUE] = IcalInterface::PERIOD; - } - $value = []; - while( ! empty( $xml2 ) && str_starts_with( $xml2, $PERIODTAG )) { - $xml3 = self::XMLgetTagContent1( $xml2, self::$period, $endIx4); - $t = []; - while( ! empty( $xml3 )) { // start - end/duration - $t[] = self::XMLgetTagContent2( $xml3, $pType, $endIx5 ); - $xml3 = substr( $xml3, $endIx5 ); - } // end while - $value[] = $t; - $xml2 = substr( $xml2, $endIx4 ); - } // end while - break; - case IcalInterface::TZOFFSETTO : // fall through - case IcalInterface::TZOFFSETFROM : - $value = str_replace( Util::$COLON, Util::$SP0, $value ); - break; - case IcalInterface::GEO : - $tValue = [ IcalInterface::LATITUDE => $value ]; - $tValue[IcalInterface::LONGITUDE] = self::XMLgetTagContent1( - substr( $xml2, $endIx3 ), - IcalInterface::LONGITUDE, - $endIx3 - ); - $value = $tValue; - break; - case IcalInterface::EXRULE : - // fall through - case IcalInterface::RRULE : - $tValue = [ $valueType => $value ]; - $xml2 = substr( $xml2, $endIx3 ); - $valueType = Util::$SP0; - while( ! empty( $xml2 )) { - $t = self::XMLgetTagContent2( $xml2, $valueType, $endIx4 ); - switch( strtoupper( $valueType )) { - case IcalInterface::FREQ : // fall through - case IcalInterface::COUNT : // fall through - case IcalInterface::INTERVAL : // fall through - case IcalInterface::RSCALE : // fall through - case IcalInterface::SKIP : // fall through - case IcalInterface::UNTIL : // fall through - case IcalInterface::WKST : - $tValue[$valueType] = $t; - break; - case IcalInterface::BYDAY : - if( 2 === strlen( $t )) { - $tValue[$valueType][] = [ IcalInterface::DAY => $t ]; - } - else { - $day = substr( $t, -2 ); - $key = substr( $t, 0, ( strlen( $t ) - 2 )); - $tValue[$valueType][] = [ $key, IcalInterface::DAY => $day ]; - } - break; - default: - $tValue[$valueType][] = $t; - } // end switch - $xml2 = substr( $xml2, $endIx4 ); - } // end while - $value = $tValue; - break; - case IcalInterface::REQUEST_STATUS : - $value = [ - self::$code => null, - self::$description => null, - self::$data => null - ]; - while( ! empty( $xml2 )) { - $t = html_entity_decode( - self::XMLgetTagContent2( $xml2, $valueType, $endIx4 )); - $value[$valueType] = $t; - $xml2 = substr( $xml2, $endIx4 ); - } // end while - break; - case IcalInterface::STRUCTURED_DATA : - $params[IcalInterface::VALUE] = match( $valueType ) { - self::$binary => IcalInterface::BINARY, - self::$text => IcalInterface::TEXT, - self::$uri => IcalInterface::URI, - }; - break; - case IcalInterface::STYLED_DESCRIPTION : - $params[IcalInterface::VALUE] = match( $valueType ) { - self::$text => IcalInterface::TEXT, - self::$uri => IcalInterface::URI - }; - break; - default: - switch( $valueType ) { - case self::$uri : - $value = html_entity_decode( $value ); - if( in_array( $propName, [ IcalInterface::ATTACH, IcalInterface::SOURCE ], true )) { - break; - } - $params[IcalInterface::VALUE] = IcalInterface::URI; - break; - case self::$binary : - $params[IcalInterface::VALUE] = IcalInterface::BINARY; - break; - case self::$date : - $params[IcalInterface::VALUE] = IcalInterface::DATE; - break; - case self::$date_time : - $params[IcalInterface::VALUE] = IcalInterface::DATE_TIME; - break; - case self::$text : - // fall through - case self::$unknown : - $value = html_entity_decode( $value ); - break; - default : - if( StringFactory::isXprefixed( $propName ) && - ( self::$unknown !== strtolower( $valueType ))) { - $params[IcalInterface::VALUE] = strtoupper( $valueType ); - } - break; - } // end switch - break; - } // end switch( $propName ) - $method = StringFactory::getSetMethodName( $propName ); - switch( true ) { - case ( in_array( $propName, $VERSIONPRODID, true )) : - break; - case ( StringFactory::isXprefixed( $propName )) : - $iCalComp->setXprop( $propName, $value, $params ); - break; - case ( in_array( $propName, [ IcalInterface::EXRULE, IcalInterface::RRULE ], true ) && - isset( $value[self::$recur] ) && empty( $value[self::$recur] )) : - $iCalComp->{$method}(); // empty rexRule - break; - case ( IcalInterface::FREEBUSY === $propName ) : - $fbtype = $params[IcalInterface::FBTYPE] ?? null; - unset( $params[IcalInterface::FBTYPE] ); - $iCalComp->{$method}( $fbtype, $value, $params ); - break; - case ( IcalInterface::GEO === $propName ) : - if( ( Util::$SP0 !== $value[IcalInterface::LATITUDE] ) && - ( Util::$SP0 !== $value[IcalInterface::LONGITUDE] )) { - $iCalComp->{$method}( - $value[IcalInterface::LATITUDE], - $value[IcalInterface::LONGITUDE], - $params - ); - } - else { - $iCalComp->{$method}(); } - break; - case ( IcalInterface::REQUEST_STATUS === $propName ) : - $iCalComp->{$method}( - $value[self::$code], - $value[self::$description], - $value[self::$data], - $params - ); - break; - default : - if( empty( $value ) && ( is_array( $value ) || ( Util::$ZERO > $value ))) { - $value = null; - } - $iCalComp->{$method}( $value, $params ); - break; - } // end switch - $xml = substr( $xml, $endIx ); - } // end while( ! empty( $xml )) - } - - /** - * Fetch a specific XML tag content - * - * @param string $xml - * @param string $tagName - * @param null|int $endIx - * @return string - * @since 2.23.8 - 2017-04-17 - */ - private static function XMLgetTagContent1( string $xml, string $tagName, ? int & $endIx = 0 ) : string - { - static $FMT0 = '<%s>'; - static $FMT1 = '<%s />'; - static $FMT2 = '<%s/>'; - static $FMT3 = ''; - $tagName = strtolower( $tagName ); - $strLen = strlen( $tagName ); - $xmlLen = strlen( $xml ); - $sx1 = 0; - while( $sx1 < $xmlLen ) { - if((( $sx1 + $strLen + 1 ) < $xmlLen ) && // start tag - ( sprintf( $FMT0, $tagName ) === strtolower( substr( $xml, $sx1, ( $strLen + 2 )))) - ) { - break; - } - if((( $sx1 + $strLen + 3 ) < $xmlLen ) && // empty tag1 - ( sprintf( $FMT1, $tagName ) === strtolower( substr( $xml, $sx1, ( $strLen + 4 )))) - ) { - $endIx = $strLen + 5; - return Util::$SP0; // empty tag - } - if((( $sx1 + $strLen + 2 ) < $xmlLen ) && // empty tag2 - ( sprintf( $FMT2, $tagName ) === strtolower( substr( $xml, $sx1, ( $strLen + 3 )))) - ) { - $endIx = $strLen + 4; - return Util::$SP0; // empty tag - } - ++$sx1; - } // end while... - if( ! isset( $xml[$sx1] )) { - $endIx = ( empty( $sx1 )) ? 0 : $sx1 - 1; // ?? - return Util::$SP0; - } - $endTag = sprintf( $FMT3, $tagName ); - if( false === ( $pos = stripos( $xml, $endTag ))) { // missing end tag?? - $endIx = $xmlLen + 1; - return Util::$SP0; - } - $endIx = $pos + $strLen + 3; - $start = $sx1 + $strLen + 2; - $len = $pos - $sx1 - 2 - $strLen; - return substr( $xml, $start, $len ); - } - - /** - * Fetch next (unknown) XML tagname AND content - * - * @param string $xml - * @param string|null $tagName - * @param int|null $endIx - * @return string - * @since 2.23.8 - 2017-04-17 - */ - private static function XMLgetTagContent2( string $xml, ? string & $tagName = null, ? int & $endIx = null ) : string - { - static $LT = '<'; - static $CMTSTART = '