diff --git a/composer.json b/composer.json index 594e780b..5db47da8 100644 --- a/composer.json +++ b/composer.json @@ -5,6 +5,7 @@ "qferr/mjml-php": "^2.0", "gettext/gettext": "^5.6", "gettext/translator": "^1.1", - "jaybizzle/crawler-detect": "^1.2" + "jaybizzle/crawler-detect": "^1.2", + "slim/psr7": "^1.6" } } diff --git a/composer.lock b/composer.lock index ce7e7768..7d3946ae 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a5706778a67e25347c7ea8e82776d5e0", + "content-hash": "e9f274cb680a99cb3a744f784d9c166d", "packages": [ { "name": "composer/ca-bundle", @@ -171,6 +171,62 @@ ], "time": "2022-10-02T15:13:01+00:00" }, + { + "name": "fig/http-message-util", + "version": "1.1.5", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message-util.git", + "reference": "9d94dc0154230ac39e5bf89398b324a86f63f765" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message-util/zipball/9d94dc0154230ac39e5bf89398b324a86f63f765", + "reference": "9d94dc0154230ac39e5bf89398b324a86f63f765", + "shasum": "" + }, + "require": { + "php": "^5.3 || ^7.0 || ^8.0" + }, + "suggest": { + "psr/http-message": "The package containing the PSR-7 interfaces" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Fig\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Utility classes and constants for use with PSR-7 (psr/http-message)", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "support": { + "issues": "https://github.com/php-fig/http-message-util/issues", + "source": "https://github.com/php-fig/http-message-util/tree/1.1.5" + }, + "time": "2020-11-24T22:02:12+00:00" + }, { "name": "gettext/gettext", "version": "v5.7.0", @@ -846,6 +902,215 @@ "source": "https://github.com/qferr/mjml-php/tree/2.0.0" }, "time": "2022-04-09T21:34:38+00:00" + }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "support": { + "issues": "https://github.com/ralouphie/getallheaders/issues", + "source": "https://github.com/ralouphie/getallheaders/tree/develop" + }, + "time": "2019-03-08T08:55:37+00:00" + }, + { + "name": "slim/psr7", + "version": "1.6", + "source": { + "type": "git", + "url": "https://github.com/slimphp/Slim-Psr7.git", + "reference": "3471c22c1a0d26c51c78f6aeb06489d38cf46a4d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/slimphp/Slim-Psr7/zipball/3471c22c1a0d26c51c78f6aeb06489d38cf46a4d", + "reference": "3471c22c1a0d26c51c78f6aeb06489d38cf46a4d", + "shasum": "" + }, + "require": { + "fig/http-message-util": "^1.1.5", + "php": "^7.4 || ^8.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.0", + "ralouphie/getallheaders": "^3.0", + "symfony/polyfill-php80": "^1.26" + }, + "provide": { + "psr/http-factory-implementation": "1.0", + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "adriansuter/php-autoload-override": "^1.3", + "ext-json": "*", + "http-interop/http-factory-tests": "^0.9.0", + "php-http/psr7-integration-tests": "dev-master", + "phpspec/prophecy": "^1.15", + "phpspec/prophecy-phpunit": "^2.0", + "phpstan/phpstan": "^1.8", + "phpunit/phpunit": "^9.5", + "squizlabs/php_codesniffer": "^3.7" + }, + "type": "library", + "autoload": { + "psr-4": { + "Slim\\Psr7\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Josh Lockhart", + "email": "hello@joshlockhart.com", + "homepage": "http://joshlockhart.com" + }, + { + "name": "Andrew Smith", + "email": "a.smith@silentworks.co.uk", + "homepage": "http://silentworks.co.uk" + }, + { + "name": "Rob Allen", + "email": "rob@akrabat.com", + "homepage": "http://akrabat.com" + }, + { + "name": "Pierre Berube", + "email": "pierre@lgse.com", + "homepage": "http://www.lgse.com" + } + ], + "description": "Strict PSR-7 implementation", + "homepage": "https://www.slimframework.com", + "keywords": [ + "http", + "psr-7", + "psr7" + ], + "support": { + "issues": "https://github.com/slimphp/Slim-Psr7/issues", + "source": "https://github.com/slimphp/Slim-Psr7/tree/1.6" + }, + "time": "2022-11-05T18:50:24+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.27.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "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\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/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" } ], "packages-dev": [], diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 0fb0a2c1..5490b88d 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -6,5 +6,10 @@ $vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( + 'Attribute' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Attribute.php', 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', + 'PhpToken' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php', + 'Stringable' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Stringable.php', + 'UnhandledMatchError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php', + 'ValueError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/ValueError.php', ); diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php index 85fef52e..01854490 100644 --- a/vendor/composer/autoload_files.php +++ b/vendor/composer/autoload_files.php @@ -6,5 +6,7 @@ $vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( + '7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php', + 'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php', '09fc349b549513bf7f4291502426f919' => $vendorDir . '/embed/embed/src/functions.php', ); diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index c5b2d4f9..282c2bdf 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -6,6 +6,8 @@ $vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( + 'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'), + 'Slim\\Psr7\\' => array($vendorDir . '/slim/psr7/src'), 'Qferrer\\Mjml\\' => array($vendorDir . '/qferr/mjml-php/src'), 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-factory/src', $vendorDir . '/psr/http-message/src'), 'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'), @@ -15,6 +17,7 @@ return array( 'Grandel\\' => array($vendorDir . '/grandel/include-directory/src'), 'Gettext\\Languages\\' => array($vendorDir . '/gettext/languages/src'), 'Gettext\\' => array($vendorDir . '/gettext/gettext/src', $vendorDir . '/gettext/translator/src'), + 'Fig\\Http\\Message\\' => array($vendorDir . '/fig/http-message-util/src'), 'Embed\\' => array($vendorDir . '/embed/embed/src'), 'Composer\\CaBundle\\' => array($vendorDir . '/composer/ca-bundle/src'), ); diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index c8c47482..4f32f1a3 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -7,10 +7,17 @@ namespace Composer\Autoload; class ComposerStaticInit5f3db9fc1d0cf1dd6a77a1d84501b4b1 { public static $files = array ( + '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php', + 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php', '09fc349b549513bf7f4291502426f919' => __DIR__ . '/..' . '/embed/embed/src/functions.php', ); public static $prefixLengthsPsr4 = array ( + 'S' => + array ( + 'Symfony\\Polyfill\\Php80\\' => 23, + 'Slim\\Psr7\\' => 10, + ), 'Q' => array ( 'Qferrer\\Mjml\\' => 13, @@ -38,6 +45,10 @@ class ComposerStaticInit5f3db9fc1d0cf1dd6a77a1d84501b4b1 'Gettext\\Languages\\' => 18, 'Gettext\\' => 8, ), + 'F' => + array ( + 'Fig\\Http\\Message\\' => 17, + ), 'E' => array ( 'Embed\\' => 6, @@ -49,6 +60,14 @@ class ComposerStaticInit5f3db9fc1d0cf1dd6a77a1d84501b4b1 ); public static $prefixDirsPsr4 = array ( + 'Symfony\\Polyfill\\Php80\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-php80', + ), + 'Slim\\Psr7\\' => + array ( + 0 => __DIR__ . '/..' . '/slim/psr7/src', + ), 'Qferrer\\Mjml\\' => array ( 0 => __DIR__ . '/..' . '/qferr/mjml-php/src', @@ -87,6 +106,10 @@ class ComposerStaticInit5f3db9fc1d0cf1dd6a77a1d84501b4b1 0 => __DIR__ . '/..' . '/gettext/gettext/src', 1 => __DIR__ . '/..' . '/gettext/translator/src', ), + 'Fig\\Http\\Message\\' => + array ( + 0 => __DIR__ . '/..' . '/fig/http-message-util/src', + ), 'Embed\\' => array ( 0 => __DIR__ . '/..' . '/embed/embed/src', @@ -108,7 +131,12 @@ class ComposerStaticInit5f3db9fc1d0cf1dd6a77a1d84501b4b1 ); public static $classMap = array ( + 'Attribute' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Attribute.php', 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', + 'PhpToken' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php', + 'Stringable' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Stringable.php', + 'UnhandledMatchError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php', + 'ValueError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/ValueError.php', ); public static function getInitializer(ClassLoader $loader) diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 7b4a519b..eb7e000d 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -171,6 +171,65 @@ ], "install-path": "../embed/embed" }, + { + "name": "fig/http-message-util", + "version": "1.1.5", + "version_normalized": "1.1.5.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message-util.git", + "reference": "9d94dc0154230ac39e5bf89398b324a86f63f765" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message-util/zipball/9d94dc0154230ac39e5bf89398b324a86f63f765", + "reference": "9d94dc0154230ac39e5bf89398b324a86f63f765", + "shasum": "" + }, + "require": { + "php": "^5.3 || ^7.0 || ^8.0" + }, + "suggest": { + "psr/http-message": "The package containing the PSR-7 interfaces" + }, + "time": "2020-11-24T22:02:12+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Fig\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Utility classes and constants for use with PSR-7 (psr/http-message)", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "support": { + "issues": "https://github.com/php-fig/http-message-util/issues", + "source": "https://github.com/php-fig/http-message-util/tree/1.1.5" + }, + "install-path": "../fig/http-message-util" + }, { "name": "gettext/gettext", "version": "v5.7.0", @@ -882,6 +941,224 @@ "source": "https://github.com/qferr/mjml-php/tree/2.0.0" }, "install-path": "../qferr/mjml-php" + }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "version_normalized": "3.0.3.0", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" + }, + "time": "2019-03-08T08:55:37+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "support": { + "issues": "https://github.com/ralouphie/getallheaders/issues", + "source": "https://github.com/ralouphie/getallheaders/tree/develop" + }, + "install-path": "../ralouphie/getallheaders" + }, + { + "name": "slim/psr7", + "version": "1.6", + "version_normalized": "1.6.0.0", + "source": { + "type": "git", + "url": "https://github.com/slimphp/Slim-Psr7.git", + "reference": "3471c22c1a0d26c51c78f6aeb06489d38cf46a4d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/slimphp/Slim-Psr7/zipball/3471c22c1a0d26c51c78f6aeb06489d38cf46a4d", + "reference": "3471c22c1a0d26c51c78f6aeb06489d38cf46a4d", + "shasum": "" + }, + "require": { + "fig/http-message-util": "^1.1.5", + "php": "^7.4 || ^8.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.0", + "ralouphie/getallheaders": "^3.0", + "symfony/polyfill-php80": "^1.26" + }, + "provide": { + "psr/http-factory-implementation": "1.0", + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "adriansuter/php-autoload-override": "^1.3", + "ext-json": "*", + "http-interop/http-factory-tests": "^0.9.0", + "php-http/psr7-integration-tests": "dev-master", + "phpspec/prophecy": "^1.15", + "phpspec/prophecy-phpunit": "^2.0", + "phpstan/phpstan": "^1.8", + "phpunit/phpunit": "^9.5", + "squizlabs/php_codesniffer": "^3.7" + }, + "time": "2022-11-05T18:50:24+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Slim\\Psr7\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Josh Lockhart", + "email": "hello@joshlockhart.com", + "homepage": "http://joshlockhart.com" + }, + { + "name": "Andrew Smith", + "email": "a.smith@silentworks.co.uk", + "homepage": "http://silentworks.co.uk" + }, + { + "name": "Rob Allen", + "email": "rob@akrabat.com", + "homepage": "http://akrabat.com" + }, + { + "name": "Pierre Berube", + "email": "pierre@lgse.com", + "homepage": "http://www.lgse.com" + } + ], + "description": "Strict PSR-7 implementation", + "homepage": "https://www.slimframework.com", + "keywords": [ + "http", + "psr-7", + "psr7" + ], + "support": { + "issues": "https://github.com/slimphp/Slim-Psr7/issues", + "source": "https://github.com/slimphp/Slim-Psr7/tree/1.6" + }, + "install-path": "../slim/psr7" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.27.0", + "version_normalized": "1.27.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "time": "2022-11-03T14:55:06+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/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" + } + ], + "install-path": "../symfony/polyfill-php80" } ], "dev": true, diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 7a5e22fa..565e4613 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => '__root__', 'pretty_version' => 'dev-develop', 'version' => 'dev-develop', - 'reference' => 'bfb62acc87f0d54380a7ece92bc34f2f03392dae', + 'reference' => '9691514be6a2e56ed57f0cf8638f4c590522c661', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -13,7 +13,7 @@ '__root__' => array( 'pretty_version' => 'dev-develop', 'version' => 'dev-develop', - 'reference' => 'bfb62acc87f0d54380a7ece92bc34f2f03392dae', + 'reference' => '9691514be6a2e56ed57f0cf8638f4c590522c661', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -37,6 +37,15 @@ 'aliases' => array(), 'dev_requirement' => false, ), + 'fig/http-message-util' => array( + 'pretty_version' => '1.1.5', + 'version' => '1.1.5.0', + 'reference' => '9d94dc0154230ac39e5bf89398b324a86f63f765', + 'type' => 'library', + 'install_path' => __DIR__ . '/../fig/http-message-util', + 'aliases' => array(), + 'dev_requirement' => false, + ), 'gettext/gettext' => array( 'pretty_version' => 'v5.7.0', 'version' => '5.7.0.0', @@ -127,6 +136,12 @@ 'aliases' => array(), 'dev_requirement' => false, ), + 'psr/http-factory-implementation' => array( + 'dev_requirement' => false, + 'provided' => array( + 0 => '1.0', + ), + ), 'psr/http-message' => array( 'pretty_version' => '1.0.1', 'version' => '1.0.1.0', @@ -136,6 +151,12 @@ 'aliases' => array(), 'dev_requirement' => false, ), + 'psr/http-message-implementation' => array( + 'dev_requirement' => false, + 'provided' => array( + 0 => '1.0', + ), + ), 'qferr/mjml-php' => array( 'pretty_version' => '2.0.0', 'version' => '2.0.0.0', @@ -145,5 +166,32 @@ 'aliases' => array(), 'dev_requirement' => false, ), + 'ralouphie/getallheaders' => array( + 'pretty_version' => '3.0.3', + 'version' => '3.0.3.0', + 'reference' => '120b605dfeb996808c31b6477290a714d356e822', + 'type' => 'library', + 'install_path' => __DIR__ . '/../ralouphie/getallheaders', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'slim/psr7' => array( + 'pretty_version' => '1.6', + 'version' => '1.6.0.0', + 'reference' => '3471c22c1a0d26c51c78f6aeb06489d38cf46a4d', + 'type' => 'library', + 'install_path' => __DIR__ . '/../slim/psr7', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'symfony/polyfill-php80' => array( + 'pretty_version' => 'v1.27.0', + 'version' => '1.27.0.0', + 'reference' => '7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/polyfill-php80', + 'aliases' => array(), + 'dev_requirement' => false, + ), ), ); diff --git a/vendor/fig/http-message-util/.gitignore b/vendor/fig/http-message-util/.gitignore new file mode 100644 index 00000000..48b8bf90 --- /dev/null +++ b/vendor/fig/http-message-util/.gitignore @@ -0,0 +1 @@ +vendor/ diff --git a/vendor/fig/http-message-util/CHANGELOG.md b/vendor/fig/http-message-util/CHANGELOG.md new file mode 100644 index 00000000..1a02e547 --- /dev/null +++ b/vendor/fig/http-message-util/CHANGELOG.md @@ -0,0 +1,147 @@ +# Changelog + +All notable changes to this project will be documented in this file, in reverse chronological order by release. + +## 1.1.5 - 2020-11-24 + +### Added + +- [#19](https://github.com/php-fig/http-message-util/pull/19) adds support for PHP 8. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 1.1.4 - 2020-02-05 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- [#15](https://github.com/php-fig/http-message-util/pull/15) removes the dependency on psr/http-message, as it is not technically necessary for usage of this package. + +### Fixed + +- Nothing. + +## 1.1.3 - 2018-11-19 + +### Added + +- [#10](https://github.com/php-fig/http-message-util/pull/10) adds the constants `StatusCodeInterface::STATUS_EARLY_HINTS` (103) and + `StatusCodeInterface::STATUS_TOO_EARLY` (425). + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 1.1.2 - 2017-02-09 + +### Added + +- [#4](https://github.com/php-fig/http-message-util/pull/4) adds the constant + `StatusCodeInterface::STATUS_MISDIRECTED_REQUEST` (421). + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 1.1.1 - 2017-02-06 + +### Added + +- [#3](https://github.com/php-fig/http-message-util/pull/3) adds the constant + `StatusCodeInterface::STATUS_IM_A_TEAPOT` (418). + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 1.1.0 - 2016-09-19 + +### Added + +- [#1](https://github.com/php-fig/http-message-util/pull/1) adds + `Fig\Http\Message\StatusCodeInterface`, with constants named after common + status reason phrases, with values indicating the status codes themselves. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 1.0.0 - 2017-08-05 + +### Added + +- Adds `Fig\Http\Message\RequestMethodInterface`, with constants covering the + most common HTTP request methods as specified by the IETF. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. diff --git a/vendor/fig/http-message-util/LICENSE b/vendor/fig/http-message-util/LICENSE new file mode 100644 index 00000000..e2fa347a --- /dev/null +++ b/vendor/fig/http-message-util/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2016 PHP Framework Interoperability Group + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/fig/http-message-util/README.md b/vendor/fig/http-message-util/README.md new file mode 100644 index 00000000..ea5b5aa7 --- /dev/null +++ b/vendor/fig/http-message-util/README.md @@ -0,0 +1,17 @@ +# PSR Http Message Util + +This repository holds utility classes and constants to facilitate common +operations of [PSR-7](https://www.php-fig.org/psr/psr-7/); the primary purpose is +to provide constants for referring to request methods, response status codes and +messages, and potentially common headers. + +Implementation of PSR-7 interfaces is **not** within the scope of this package. + +## Installation + +Install by adding the package as a [Composer](https://getcomposer.org) +requirement: + +```bash +$ composer require fig/http-message-util +``` diff --git a/vendor/fig/http-message-util/composer.json b/vendor/fig/http-message-util/composer.json new file mode 100644 index 00000000..8645893b --- /dev/null +++ b/vendor/fig/http-message-util/composer.json @@ -0,0 +1,28 @@ +{ + "name": "fig/http-message-util", + "description": "Utility classes and constants for use with PSR-7 (psr/http-message)", + "keywords": ["psr", "psr-7", "http", "http-message", "request", "response"], + "license": "MIT", + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "require": { + "php": "^5.3 || ^7.0 || ^8.0" + }, + "suggest": { + "psr/http-message": "The package containing the PSR-7 interfaces" + }, + "autoload": { + "psr-4": { + "Fig\\Http\\Message\\": "src/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + } +} diff --git a/vendor/fig/http-message-util/src/RequestMethodInterface.php b/vendor/fig/http-message-util/src/RequestMethodInterface.php new file mode 100644 index 00000000..97d9a93b --- /dev/null +++ b/vendor/fig/http-message-util/src/RequestMethodInterface.php @@ -0,0 +1,34 @@ + + * class RequestFactory implements RequestMethodInterface + * { + * public static function factory( + * $uri = '/', + * $method = self::METHOD_GET, + * $data = [] + * ) { + * } + * } + * + */ +interface RequestMethodInterface +{ + const METHOD_HEAD = 'HEAD'; + const METHOD_GET = 'GET'; + const METHOD_POST = 'POST'; + const METHOD_PUT = 'PUT'; + const METHOD_PATCH = 'PATCH'; + const METHOD_DELETE = 'DELETE'; + const METHOD_PURGE = 'PURGE'; + const METHOD_OPTIONS = 'OPTIONS'; + const METHOD_TRACE = 'TRACE'; + const METHOD_CONNECT = 'CONNECT'; +} diff --git a/vendor/fig/http-message-util/src/StatusCodeInterface.php b/vendor/fig/http-message-util/src/StatusCodeInterface.php new file mode 100644 index 00000000..99b7e780 --- /dev/null +++ b/vendor/fig/http-message-util/src/StatusCodeInterface.php @@ -0,0 +1,107 @@ + + * class ResponseFactory implements StatusCodeInterface + * { + * public function createResponse($code = self::STATUS_OK) + * { + * } + * } + * + */ +interface StatusCodeInterface +{ + // Informational 1xx + const STATUS_CONTINUE = 100; + const STATUS_SWITCHING_PROTOCOLS = 101; + const STATUS_PROCESSING = 102; + const STATUS_EARLY_HINTS = 103; + // Successful 2xx + const STATUS_OK = 200; + const STATUS_CREATED = 201; + const STATUS_ACCEPTED = 202; + const STATUS_NON_AUTHORITATIVE_INFORMATION = 203; + const STATUS_NO_CONTENT = 204; + const STATUS_RESET_CONTENT = 205; + const STATUS_PARTIAL_CONTENT = 206; + const STATUS_MULTI_STATUS = 207; + const STATUS_ALREADY_REPORTED = 208; + const STATUS_IM_USED = 226; + // Redirection 3xx + const STATUS_MULTIPLE_CHOICES = 300; + const STATUS_MOVED_PERMANENTLY = 301; + const STATUS_FOUND = 302; + const STATUS_SEE_OTHER = 303; + const STATUS_NOT_MODIFIED = 304; + const STATUS_USE_PROXY = 305; + const STATUS_RESERVED = 306; + const STATUS_TEMPORARY_REDIRECT = 307; + const STATUS_PERMANENT_REDIRECT = 308; + // Client Errors 4xx + const STATUS_BAD_REQUEST = 400; + const STATUS_UNAUTHORIZED = 401; + const STATUS_PAYMENT_REQUIRED = 402; + const STATUS_FORBIDDEN = 403; + const STATUS_NOT_FOUND = 404; + const STATUS_METHOD_NOT_ALLOWED = 405; + const STATUS_NOT_ACCEPTABLE = 406; + const STATUS_PROXY_AUTHENTICATION_REQUIRED = 407; + const STATUS_REQUEST_TIMEOUT = 408; + const STATUS_CONFLICT = 409; + const STATUS_GONE = 410; + const STATUS_LENGTH_REQUIRED = 411; + const STATUS_PRECONDITION_FAILED = 412; + const STATUS_PAYLOAD_TOO_LARGE = 413; + const STATUS_URI_TOO_LONG = 414; + const STATUS_UNSUPPORTED_MEDIA_TYPE = 415; + const STATUS_RANGE_NOT_SATISFIABLE = 416; + const STATUS_EXPECTATION_FAILED = 417; + const STATUS_IM_A_TEAPOT = 418; + const STATUS_MISDIRECTED_REQUEST = 421; + const STATUS_UNPROCESSABLE_ENTITY = 422; + const STATUS_LOCKED = 423; + const STATUS_FAILED_DEPENDENCY = 424; + const STATUS_TOO_EARLY = 425; + const STATUS_UPGRADE_REQUIRED = 426; + const STATUS_PRECONDITION_REQUIRED = 428; + const STATUS_TOO_MANY_REQUESTS = 429; + const STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE = 431; + const STATUS_UNAVAILABLE_FOR_LEGAL_REASONS = 451; + // Server Errors 5xx + const STATUS_INTERNAL_SERVER_ERROR = 500; + const STATUS_NOT_IMPLEMENTED = 501; + const STATUS_BAD_GATEWAY = 502; + const STATUS_SERVICE_UNAVAILABLE = 503; + const STATUS_GATEWAY_TIMEOUT = 504; + const STATUS_VERSION_NOT_SUPPORTED = 505; + const STATUS_VARIANT_ALSO_NEGOTIATES = 506; + const STATUS_INSUFFICIENT_STORAGE = 507; + const STATUS_LOOP_DETECTED = 508; + const STATUS_NOT_EXTENDED = 510; + const STATUS_NETWORK_AUTHENTICATION_REQUIRED = 511; +} diff --git a/vendor/ralouphie/getallheaders/LICENSE b/vendor/ralouphie/getallheaders/LICENSE new file mode 100644 index 00000000..be5540c2 --- /dev/null +++ b/vendor/ralouphie/getallheaders/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Ralph Khattar + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/ralouphie/getallheaders/README.md b/vendor/ralouphie/getallheaders/README.md new file mode 100644 index 00000000..9430d76b --- /dev/null +++ b/vendor/ralouphie/getallheaders/README.md @@ -0,0 +1,27 @@ +getallheaders +============= + +PHP `getallheaders()` polyfill. Compatible with PHP >= 5.3. + +[![Build Status](https://travis-ci.org/ralouphie/getallheaders.svg?branch=master)](https://travis-ci.org/ralouphie/getallheaders) +[![Coverage Status](https://coveralls.io/repos/ralouphie/getallheaders/badge.png?branch=master)](https://coveralls.io/r/ralouphie/getallheaders?branch=master) +[![Latest Stable Version](https://poser.pugx.org/ralouphie/getallheaders/v/stable.png)](https://packagist.org/packages/ralouphie/getallheaders) +[![Latest Unstable Version](https://poser.pugx.org/ralouphie/getallheaders/v/unstable.png)](https://packagist.org/packages/ralouphie/getallheaders) +[![License](https://poser.pugx.org/ralouphie/getallheaders/license.png)](https://packagist.org/packages/ralouphie/getallheaders) + + +This is a simple polyfill for [`getallheaders()`](http://www.php.net/manual/en/function.getallheaders.php). + +## Install + +For PHP version **`>= 5.6`**: + +``` +composer require ralouphie/getallheaders +``` + +For PHP version **`< 5.6`**: + +``` +composer require ralouphie/getallheaders "^2" +``` diff --git a/vendor/ralouphie/getallheaders/composer.json b/vendor/ralouphie/getallheaders/composer.json new file mode 100644 index 00000000..de8ce62e --- /dev/null +++ b/vendor/ralouphie/getallheaders/composer.json @@ -0,0 +1,26 @@ +{ + "name": "ralouphie/getallheaders", + "description": "A polyfill for getallheaders.", + "license": "MIT", + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "require": { + "php": ">=5.6" + }, + "require-dev": { + "phpunit/phpunit": "^5 || ^6.5", + "php-coveralls/php-coveralls": "^2.1" + }, + "autoload": { + "files": ["src/getallheaders.php"] + }, + "autoload-dev": { + "psr-4": { + "getallheaders\\Tests\\": "tests/" + } + } +} diff --git a/vendor/ralouphie/getallheaders/src/getallheaders.php b/vendor/ralouphie/getallheaders/src/getallheaders.php new file mode 100644 index 00000000..c7285a5b --- /dev/null +++ b/vendor/ralouphie/getallheaders/src/getallheaders.php @@ -0,0 +1,46 @@ + 'Content-Type', + 'CONTENT_LENGTH' => 'Content-Length', + 'CONTENT_MD5' => 'Content-Md5', + ); + + foreach ($_SERVER as $key => $value) { + if (substr($key, 0, 5) === 'HTTP_') { + $key = substr($key, 5); + if (!isset($copy_server[$key]) || !isset($_SERVER[$key])) { + $key = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', $key)))); + $headers[$key] = $value; + } + } elseif (isset($copy_server[$key])) { + $headers[$copy_server[$key]] = $value; + } + } + + if (!isset($headers['Authorization'])) { + if (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])) { + $headers['Authorization'] = $_SERVER['REDIRECT_HTTP_AUTHORIZATION']; + } elseif (isset($_SERVER['PHP_AUTH_USER'])) { + $basic_pass = isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : ''; + $headers['Authorization'] = 'Basic ' . base64_encode($_SERVER['PHP_AUTH_USER'] . ':' . $basic_pass); + } elseif (isset($_SERVER['PHP_AUTH_DIGEST'])) { + $headers['Authorization'] = $_SERVER['PHP_AUTH_DIGEST']; + } + } + + return $headers; + } + +} diff --git a/vendor/slim/psr7/LICENSE.md b/vendor/slim/psr7/LICENSE.md new file mode 100644 index 00000000..2bd2d5af --- /dev/null +++ b/vendor/slim/psr7/LICENSE.md @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Slim Framework + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/vendor/slim/psr7/MAINTAINERS.md b/vendor/slim/psr7/MAINTAINERS.md new file mode 100644 index 00000000..5c2496e1 --- /dev/null +++ b/vendor/slim/psr7/MAINTAINERS.md @@ -0,0 +1,17 @@ +# Maintainers + +There aren't many rules for maintainers of Slim-Psr7 to remember; what we have is listed here. + +## We don't merge our own PRs + +Our code is better if more than one set of eyes looks at it. Therefore we do not merge our own pull requests unless there is an exceptional circumstance. This helps to spot errors in the patch and also enables us to share information about the project around the maintainer team. + +## PRs tagged `[WIP]` are not ready to be merged + +Sometimes it's helpful to collaborate on a patch before it's ready to be merged. We use the `[WIP]` tag (for _Work in Progress_) in the title to mark these PRs. + +If a PR has `[WIP]` in its title, then it is not to be merged. The person who raised the PR will remove the `[WIP]` tag when they are ready for a full review and merge. + +## Assign a merged PR to a milestone + +By ensuring that all merged PRs are assigned to a milestone, we can easily find which PRs were in which release. diff --git a/vendor/slim/psr7/composer.json b/vendor/slim/psr7/composer.json new file mode 100644 index 00000000..318f710e --- /dev/null +++ b/vendor/slim/psr7/composer.json @@ -0,0 +1,76 @@ +{ + "name": "slim/psr7", + "type": "library", + "description": "Strict PSR-7 implementation", + "keywords": ["psr7","psr-7","http"], + "homepage": "https://www.slimframework.com", + "license": "MIT", + "authors": [ + { + "name": "Josh Lockhart", + "email": "hello@joshlockhart.com", + "homepage": "http://joshlockhart.com" + }, + { + "name": "Andrew Smith", + "email": "a.smith@silentworks.co.uk", + "homepage": "http://silentworks.co.uk" + }, + { + "name": "Rob Allen", + "email": "rob@akrabat.com", + "homepage": "http://akrabat.com" + }, + { + "name": "Pierre Berube", + "email": "pierre@lgse.com", + "homepage": "http://www.lgse.com" + } + ], + "require": { + "php": "^7.4 || ^8.0", + "fig/http-message-util": "^1.1.5", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.0", + "ralouphie/getallheaders": "^3.0", + "symfony/polyfill-php80": "^1.26" + }, + "require-dev": { + "ext-json": "*", + "adriansuter/php-autoload-override": "^1.3", + "http-interop/http-factory-tests": "^0.9.0", + "php-http/psr7-integration-tests": "dev-master", + "phpspec/prophecy": "^1.15", + "phpspec/prophecy-phpunit": "^2.0", + "phpstan/phpstan": "^1.8", + "phpunit/phpunit": "^9.5", + "squizlabs/php_codesniffer": "^3.7" + }, + "provide": { + "psr/http-message-implementation": "1.0", + "psr/http-factory-implementation": "1.0" + }, + "autoload": { + "psr-4": { + "Slim\\Psr7\\": "src" + } + }, + "autoload-dev": { + "psr-4": { + "Slim\\Tests\\Psr7\\": "tests" + } + }, + "scripts": { + "test": [ + "@phpunit", + "@phpcs", + "@phpstan" + ], + "phpunit": "phpunit", + "phpcs": "phpcs", + "phpstan": "phpstan --memory-limit=-1" + }, + "config": { + "sort-packages": true + } +} diff --git a/vendor/slim/psr7/src/Cookies.php b/vendor/slim/psr7/src/Cookies.php new file mode 100644 index 00000000..044d438e --- /dev/null +++ b/vendor/slim/psr7/src/Cookies.php @@ -0,0 +1,218 @@ + '', + 'domain' => null, + 'hostonly' => null, + 'path' => null, + 'expires' => null, + 'secure' => false, + 'httponly' => false, + 'samesite' => null + ]; + + /** + * @param array $cookies + */ + public function __construct(array $cookies = []) + { + $this->requestCookies = $cookies; + } + + /** + * Set default cookie properties + * + * @param array $settings + * + * @return static + */ + public function setDefaults(array $settings): self + { + $this->defaults = array_replace($this->defaults, $settings); + + return $this; + } + + /** + * Get cookie + * + * @param string $name + * @param string|array|null $default + * @return mixed|null + */ + public function get(string $name, $default = null) + { + return array_key_exists($name, $this->requestCookies) ? $this->requestCookies[$name] : $default; + } + + /** + * Set cookie + * + * @param string $name + * @param string|array $value + * @return static + */ + public function set(string $name, $value): self + { + if (!is_array($value)) { + $value = ['value' => $value]; + } + + $this->responseCookies[$name] = array_replace($this->defaults, $value); + + return $this; + } + + /** + * Convert all response cookies into an associate array of header values + * + * @return array + */ + public function toHeaders(): array + { + $headers = []; + + foreach ($this->responseCookies as $name => $properties) { + $headers[] = $this->toHeader($name, $properties); + } + + return $headers; + } + + /** + * Convert to `Set-Cookie` header + * + * @param string $name Cookie name + * @param array $properties Cookie properties + * + * @return string + */ + protected function toHeader(string $name, array $properties): string + { + $result = urlencode($name) . '=' . urlencode($properties['value']); + + if (isset($properties['domain'])) { + $result .= '; domain=' . $properties['domain']; + } + + if (isset($properties['path'])) { + $result .= '; path=' . $properties['path']; + } + + if (isset($properties['expires'])) { + if (is_string($properties['expires'])) { + $timestamp = strtotime($properties['expires']); + } else { + $timestamp = (int) $properties['expires']; + } + if ($timestamp && $timestamp !== 0) { + $result .= '; expires=' . gmdate('D, d-M-Y H:i:s e', $timestamp); + } + } + + if (isset($properties['secure']) && $properties['secure']) { + $result .= '; secure'; + } + + if (isset($properties['hostonly']) && $properties['hostonly']) { + $result .= '; HostOnly'; + } + + if (isset($properties['httponly']) && $properties['httponly']) { + $result .= '; HttpOnly'; + } + + if ( + isset($properties['samesite']) + && in_array(strtolower($properties['samesite']), ['lax', 'strict', 'none'], true) + ) { + // While strtolower is needed for correct comparison, the RFC doesn't care about case + $result .= '; SameSite=' . $properties['samesite']; + } + + return $result; + } + + /** + * Parse cookie values from header value + * + * Returns an associative array of cookie names and values + * + * @param string|array $header + * + * @return array + */ + public static function parseHeader($header): array + { + if (is_array($header)) { + $header = $header[0] ?? ''; + } + + if (!is_string($header)) { + throw new InvalidArgumentException('Cannot parse Cookie data. Header value must be a string.'); + } + + $header = rtrim($header, "\r\n"); + $pieces = preg_split('@[;]\s*@', $header); + $cookies = []; + + if (is_array($pieces)) { + foreach ($pieces as $cookie) { + $cookie = explode('=', $cookie, 2); + + if (count($cookie) === 2) { + $key = urldecode($cookie[0]); + $value = urldecode($cookie[1]); + + if (!isset($cookies[$key])) { + $cookies[$key] = $value; + } + } + } + } + + return $cookies; + } +} diff --git a/vendor/slim/psr7/src/Environment.php b/vendor/slim/psr7/src/Environment.php new file mode 100644 index 00000000..55f187b3 --- /dev/null +++ b/vendor/slim/psr7/src/Environment.php @@ -0,0 +1,55 @@ + 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', + 'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', + 'HTTP_ACCEPT_LANGUAGE' => 'en-US,en;q=0.8', + 'HTTP_USER_AGENT' => 'Slim Framework', + 'QUERY_STRING' => '', + 'REMOTE_ADDR' => '127.0.0.1', + 'REQUEST_METHOD' => 'GET', + 'REQUEST_SCHEME' => $scheme, + 'REQUEST_TIME' => time(), + 'REQUEST_TIME_FLOAT' => microtime(true), + 'REQUEST_URI' => '', + 'SCRIPT_NAME' => '', + 'SERVER_NAME' => 'localhost', + 'SERVER_PORT' => $port, + 'SERVER_PROTOCOL' => 'HTTP/1.1', + ], $data); + } +} diff --git a/vendor/slim/psr7/src/Factory/RequestFactory.php b/vendor/slim/psr7/src/Factory/RequestFactory.php new file mode 100644 index 00000000..e825ee37 --- /dev/null +++ b/vendor/slim/psr7/src/Factory/RequestFactory.php @@ -0,0 +1,59 @@ +streamFactory = $streamFactory ?? new StreamFactory(); + $this->uriFactory = $uriFactory ?? new UriFactory(); + } + + /** + * {@inheritdoc} + */ + public function createRequest(string $method, $uri): RequestInterface + { + if (is_string($uri)) { + $uri = $this->uriFactory->createUri($uri); + } + + if (!$uri instanceof UriInterface) { + throw new InvalidArgumentException( + 'Parameter 2 of RequestFactory::createRequest() must be a string or a compatible UriInterface.' + ); + } + + $body = $this->streamFactory->createStream(); + + return new Request($method, $uri, new Headers(), [], [], $body); + } +} diff --git a/vendor/slim/psr7/src/Factory/ResponseFactory.php b/vendor/slim/psr7/src/Factory/ResponseFactory.php new file mode 100644 index 00000000..c1a23a7d --- /dev/null +++ b/vendor/slim/psr7/src/Factory/ResponseFactory.php @@ -0,0 +1,35 @@ +withStatus($code, $reasonPhrase); + } + + return $res; + } +} diff --git a/vendor/slim/psr7/src/Factory/ServerRequestFactory.php b/vendor/slim/psr7/src/Factory/ServerRequestFactory.php new file mode 100644 index 00000000..5bc2447a --- /dev/null +++ b/vendor/slim/psr7/src/Factory/ServerRequestFactory.php @@ -0,0 +1,110 @@ +streamFactory = $streamFactory ?? new StreamFactory(); + $this->uriFactory = $uriFactory ?? new UriFactory(); + } + + /** + * {@inheritdoc} + */ + public function createServerRequest(string $method, $uri, array $serverParams = []): ServerRequestInterface + { + if (is_string($uri)) { + $uri = $this->uriFactory->createUri($uri); + } + + if (!$uri instanceof UriInterface) { + throw new InvalidArgumentException('URI must either be string or instance of ' . UriInterface::class); + } + + $body = $this->streamFactory->createStream(); + $headers = new Headers(); + $cookies = []; + + if (!empty($serverParams)) { + $headers = Headers::createFromGlobals(); + $cookies = Cookies::parseHeader($headers->getHeader('Cookie', [])); + } + + return new Request($method, $uri, $headers, $cookies, $serverParams, $body); + } + + /** + * Create new ServerRequest from environment. + * + * @internal This method is not part of PSR-17 + * + * @return Request + */ + public static function createFromGlobals(): Request + { + $method = $_SERVER['REQUEST_METHOD'] ?? 'GET'; + $uri = (new UriFactory())->createFromGlobals($_SERVER); + + $headers = Headers::createFromGlobals(); + $cookies = Cookies::parseHeader($headers->getHeader('Cookie', [])); + + // Cache the php://input stream as it cannot be re-read + $cacheResource = fopen('php://temp', 'wb+'); + $cache = $cacheResource ? new Stream($cacheResource) : null; + + $body = (new StreamFactory())->createStreamFromFile('php://input', 'r', $cache); + $uploadedFiles = UploadedFile::createFromGlobals($_SERVER); + + $request = new Request($method, $uri, $headers, $cookies, $_SERVER, $body, $uploadedFiles); + $contentTypes = $request->getHeader('Content-Type'); + + $parsedContentType = ''; + foreach ($contentTypes as $contentType) { + $fragments = explode(';', $contentType); + $parsedContentType = current($fragments); + } + + $contentTypesWithParsedBodies = ['application/x-www-form-urlencoded', 'multipart/form-data']; + if ($method === 'POST' && in_array($parsedContentType, $contentTypesWithParsedBodies)) { + return $request->withParsedBody($_POST); + } + + return $request; + } +} diff --git a/vendor/slim/psr7/src/Factory/StreamFactory.php b/vendor/slim/psr7/src/Factory/StreamFactory.php new file mode 100644 index 00000000..31d99b5e --- /dev/null +++ b/vendor/slim/psr7/src/Factory/StreamFactory.php @@ -0,0 +1,95 @@ +createStreamFromResource($resource); + } + + /** + * {@inheritdoc} + */ + public function createStreamFromFile( + string $filename, + string $mode = 'r', + StreamInterface $cache = null + ): StreamInterface { + set_error_handler( + static function (int $errno, string $errstr) use ($filename, $mode): void { + throw new RuntimeException( + "Unable to open $filename using mode $mode: $errstr", + $errno + ); + } + ); + + try { + $resource = fopen($filename, $mode); + } catch (ValueError $exception) { + throw new RuntimeException("Unable to open $filename using mode $mode: " . $exception->getMessage()); + } finally { + restore_error_handler(); + } + + if (!is_resource($resource)) { + throw new RuntimeException( + "StreamFactory::createStreamFromFile() could not create resource from file `$filename`" + ); + } + + return new Stream($resource, $cache); + } + + /** + * {@inheritdoc} + */ + public function createStreamFromResource($resource, StreamInterface $cache = null): StreamInterface + { + if (!is_resource($resource)) { + throw new InvalidArgumentException( + 'Parameter 1 of StreamFactory::createStreamFromResource() must be a resource.' + ); + } + + return new Stream($resource, $cache); + } +} diff --git a/vendor/slim/psr7/src/Factory/UploadedFileFactory.php b/vendor/slim/psr7/src/Factory/UploadedFileFactory.php new file mode 100644 index 00000000..5699e96d --- /dev/null +++ b/vendor/slim/psr7/src/Factory/UploadedFileFactory.php @@ -0,0 +1,47 @@ +getMetadata('uri'); + + if (!is_string($file) || !$stream->isReadable()) { + throw new InvalidArgumentException('File is not readable.'); + } + + if ($size === null) { + $size = $stream->getSize(); + } + + return new UploadedFile($stream, $clientFilename, $clientMediaType, $size, $error); + } +} diff --git a/vendor/slim/psr7/src/Factory/UriFactory.php b/vendor/slim/psr7/src/Factory/UriFactory.php new file mode 100644 index 00000000..74ab377a --- /dev/null +++ b/vendor/slim/psr7/src/Factory/UriFactory.php @@ -0,0 +1,113 @@ + 1) { + $queryString = parse_url('https://www.example.com' . $globals['REQUEST_URI'], PHP_URL_QUERY) ?? ''; + } + } + + // Build Uri and return + return new Uri($scheme, $host, $port, $requestUri, $queryString, '', $username, $password); + } +} diff --git a/vendor/slim/psr7/src/Header.php b/vendor/slim/psr7/src/Header.php new file mode 100644 index 00000000..ecdad32d --- /dev/null +++ b/vendor/slim/psr7/src/Header.php @@ -0,0 +1,96 @@ +originalName = $originalName; + $this->normalizedName = $normalizedName; + $this->values = $values; + } + + /** + * @return string + */ + public function getOriginalName(): string + { + return $this->originalName; + } + + /** + * @return string + */ + public function getNormalizedName(): string + { + return $this->normalizedName; + } + + /** + * @param string $value + * + * @return self + */ + public function addValue(string $value): self + { + $this->values[] = $value; + + return $this; + } + + /** + * @param array|string $values + * + * @return self + */ + public function addValues($values): self + { + if (is_string($values)) { + return $this->addValue($values); + } + + if (!is_array($values)) { + throw new InvalidArgumentException('Parameter 1 of Header::addValues() should be a string or an array.'); + } + + $this->values = array_merge($this->values, $values); + + return $this; + } + + /** + * @return array + */ + public function getValues(): array + { + return $this->values; + } +} diff --git a/vendor/slim/psr7/src/Headers.php b/vendor/slim/psr7/src/Headers.php new file mode 100644 index 00000000..038e7920 --- /dev/null +++ b/vendor/slim/psr7/src/Headers.php @@ -0,0 +1,318 @@ +globals = $globals ?? $_SERVER; + $this->setHeaders($headers); + } + + /** + * {@inheritdoc} + */ + public function addHeader($name, $value): HeadersInterface + { + [$values, $originalName, $normalizedName] = $this->prepareHeader($name, $value); + + if (isset($this->headers[$normalizedName])) { + $header = $this->headers[$normalizedName]; + $header->addValues($values); + } else { + $this->headers[$normalizedName] = new Header($originalName, $normalizedName, $values); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function removeHeader(string $name): HeadersInterface + { + $name = $this->normalizeHeaderName($name); + unset($this->headers[$name]); + return $this; + } + + /** + * {@inheritdoc} + */ + public function getHeader(string $name, $default = []): array + { + $name = $this->normalizeHeaderName($name); + + if (isset($this->headers[$name])) { + $header = $this->headers[$name]; + return $header->getValues(); + } + + if (empty($default)) { + return $default; + } + + $this->validateHeader($name, $default); + return $this->trimHeaderValue($default); + } + + /** + * {@inheritdoc} + */ + public function setHeader($name, $value): HeadersInterface + { + [$values, $originalName, $normalizedName] = $this->prepareHeader($name, $value); + + // Ensure we preserve original case if the header already exists in the stack + if (isset($this->headers[$normalizedName])) { + $existingHeader = $this->headers[$normalizedName]; + $originalName = $existingHeader->getOriginalName(); + } + + $this->headers[$normalizedName] = new Header($originalName, $normalizedName, $values); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setHeaders(array $headers): HeadersInterface + { + $this->headers = []; + + foreach ($this->parseAuthorizationHeader($headers) as $name => $value) { + $this->addHeader($name, $value); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function hasHeader(string $name): bool + { + $name = $this->normalizeHeaderName($name); + return isset($this->headers[$name]); + } + + /** + * {@inheritdoc} + */ + public function getHeaders(bool $originalCase = false): array + { + $headers = []; + + foreach ($this->headers as $header) { + $name = $originalCase ? $header->getOriginalName() : $header->getNormalizedName(); + $headers[$name] = $header->getValues(); + } + + return $headers; + } + + /** + * @param string $name + * @param bool $preserveCase + * @return string + */ + protected function normalizeHeaderName(string $name, bool $preserveCase = false): string + { + $name = strtr($name, '_', '-'); + + if (!$preserveCase) { + $name = strtolower($name); + } + + if (strpos(strtolower($name), 'http-') === 0) { + $name = substr($name, 5); + } + + return $name; + } + + /** + * Parse incoming headers and determine Authorization header from original headers + * + * @param array $headers + * @return array + */ + protected function parseAuthorizationHeader(array $headers): array + { + $hasAuthorizationHeader = false; + foreach ($headers as $name => $value) { + if (strtolower((string) $name) === 'authorization') { + $hasAuthorizationHeader = true; + break; + } + } + + if (!$hasAuthorizationHeader) { + if (isset($this->globals['REDIRECT_HTTP_AUTHORIZATION'])) { + $headers['Authorization'] = $this->globals['REDIRECT_HTTP_AUTHORIZATION']; + } elseif (isset($this->globals['PHP_AUTH_USER'])) { + $pw = $this->globals['PHP_AUTH_PW'] ?? ''; + $headers['Authorization'] = 'Basic ' . base64_encode($this->globals['PHP_AUTH_USER'] . ':' . $pw); + } elseif (isset($this->globals['PHP_AUTH_DIGEST'])) { + $headers['Authorization'] = $this->globals['PHP_AUTH_DIGEST']; + } + } + + return $headers; + } + + /** + * @param array|string $value + * + * @return array + */ + protected function trimHeaderValue($value): array + { + $items = is_array($value) ? $value : [$value]; + $result = []; + foreach ($items as $item) { + $result[] = trim((string) $item, " \t"); + } + return $result; + } + + /** + * @param string $name + * @param array|string $value + * + * @throws InvalidArgumentException + * + * @return array + */ + protected function prepareHeader($name, $value): array + { + $this->validateHeader($name, $value); + $values = $this->trimHeaderValue($value); + $originalName = $this->normalizeHeaderName($name, true); + $normalizedName = $this->normalizeHeaderName($name); + return [$values, $originalName, $normalizedName]; + } + + /** + * Make sure the header complies with RFC 7230. + * + * Header names must be a non-empty string consisting of token characters. + * + * Header values must be strings consisting of visible characters with all optional + * leading and trailing whitespace stripped. This method will always strip such + * optional whitespace. Note that the method does not allow folding whitespace within + * the values as this was deprecated for almost all instances by the RFC. + * + * header-field = field-name ":" OWS field-value OWS + * field-name = 1*( "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." / "^" + * / "_" / "`" / "|" / "~" / %x30-39 / ( %x41-5A / %x61-7A ) ) + * OWS = *( SP / HTAB ) + * field-value = *( ( %x21-7E / %x80-FF ) [ 1*( SP / HTAB ) ( %x21-7E / %x80-FF ) ] ) + * + * @see https://tools.ietf.org/html/rfc7230#section-3.2.4 + * + * @param string $name + * @param array|string $value + * + * @throws InvalidArgumentException; + */ + protected function validateHeader($name, $value): void + { + $this->validateHeaderName($name); + $this->validateHeaderValue($value); + } + + /** + * @param mixed $name + * + * @throws InvalidArgumentException + */ + protected function validateHeaderName($name): void + { + if (!is_string($name) || preg_match("@^[!#$%&'*+.^_`|~0-9A-Za-z-]+$@", $name) !== 1) { + throw new InvalidArgumentException('Header name must be an RFC 7230 compatible string.'); + } + } + + /** + * @param mixed $value + * + * @throws InvalidArgumentException + */ + protected function validateHeaderValue($value): void + { + $items = is_array($value) ? $value : [$value]; + + if (empty($items)) { + throw new InvalidArgumentException( + 'Header values must be a string or an array of strings, empty array given.' + ); + } + + $pattern = "@^[ \t\x21-\x7E\x80-\xFF]*$@"; + foreach ($items as $item) { + $hasInvalidType = !is_numeric($item) && !is_string($item); + $rejected = $hasInvalidType || preg_match($pattern, (string) $item) !== 1; + if ($rejected) { + throw new InvalidArgumentException( + 'Header values must be RFC 7230 compatible strings.' + ); + } + } + } + + /** + * @return static + */ + public static function createFromGlobals() + { + $headers = null; + + if (function_exists('getallheaders')) { + $headers = getallheaders(); + } + + if (!is_array($headers)) { + $headers = []; + } + + return new static($headers); + } +} diff --git a/vendor/slim/psr7/src/Interfaces/HeadersInterface.php b/vendor/slim/psr7/src/Interfaces/HeadersInterface.php new file mode 100644 index 00000000..3f486f17 --- /dev/null +++ b/vendor/slim/psr7/src/Interfaces/HeadersInterface.php @@ -0,0 +1,90 @@ + true, + '1.1' => true, + '2.0' => true, + '2' => true, + ]; + + /** + * @var HeadersInterface + */ + protected $headers; + + /** + * @var StreamInterface + */ + protected $body; + + /** + * Disable magic setter to ensure immutability + * + * @param string $name The property name + * @param mixed $value The property value + * + * @return void + */ + public function __set($name, $value): void + { + // Do nothing + } + + /** + * {@inheritdoc} + */ + public function getProtocolVersion(): string + { + return $this->protocolVersion; + } + + /** + * @return static + * {@inheritdoc} + */ + public function withProtocolVersion($version) + { + if (!isset(self::$validProtocolVersions[$version])) { + throw new InvalidArgumentException( + 'Invalid HTTP version. Must be one of: ' + . implode(', ', array_keys(self::$validProtocolVersions)) + ); + } + + $clone = clone $this; + $clone->protocolVersion = $version; + + return $clone; + } + + /** + * {@inheritdoc} + */ + public function getHeaders(): array + { + return $this->headers->getHeaders(true); + } + + /** + * {@inheritdoc} + */ + public function hasHeader($name): bool + { + return $this->headers->hasHeader($name); + } + + /** + * {@inheritdoc} + */ + public function getHeader($name): array + { + return $this->headers->getHeader($name); + } + + /** + * {@inheritdoc} + */ + public function getHeaderLine($name): string + { + $values = $this->headers->getHeader($name); + return implode(',', $values); + } + + /** + * @return static + * {@inheritdoc} + */ + public function withHeader($name, $value) + { + $clone = clone $this; + $clone->headers->setHeader($name, $value); + + if ($this instanceof Response && $this->body instanceof NonBufferedBody) { + header(sprintf('%s: %s', $name, $clone->getHeaderLine($name))); + } + + return $clone; + } + + /** + * @return static + * {@inheritdoc} + */ + public function withAddedHeader($name, $value) + { + $clone = clone $this; + $clone->headers->addHeader($name, $value); + + if ($this instanceof Response && $this->body instanceof NonBufferedBody) { + header(sprintf('%s: %s', $name, $clone->getHeaderLine($name))); + } + + return $clone; + } + + /** + * @return static + * {@inheritdoc} + */ + public function withoutHeader($name) + { + $clone = clone $this; + $clone->headers->removeHeader($name); + + if ($this instanceof Response && $this->body instanceof NonBufferedBody) { + header_remove($name); + } + + return $clone; + } + + /** + * {@inheritdoc} + */ + public function getBody(): StreamInterface + { + return $this->body; + } + + /** + * @return static + * {@inheritdoc} + */ + public function withBody(StreamInterface $body) + { + $clone = clone $this; + $clone->body = $body; + + return $clone; + } +} diff --git a/vendor/slim/psr7/src/NonBufferedBody.php b/vendor/slim/psr7/src/NonBufferedBody.php new file mode 100644 index 00000000..ad22c2d7 --- /dev/null +++ b/vendor/slim/psr7/src/NonBufferedBody.php @@ -0,0 +1,153 @@ +method = $this->filterMethod($method); + $this->uri = $uri; + $this->headers = $headers; + $this->cookies = $cookies; + $this->serverParams = $serverParams; + $this->attributes = []; + $this->body = $body; + $this->uploadedFiles = $uploadedFiles; + + if (isset($serverParams['SERVER_PROTOCOL'])) { + $this->protocolVersion = str_replace('HTTP/', '', $serverParams['SERVER_PROTOCOL']); + } + + if (!$this->headers->hasHeader('Host') || $this->uri->getHost() !== '') { + $this->headers->setHeader('Host', $this->uri->getHost()); + } + } + + /** + * This method is applied to the cloned object after PHP performs an initial shallow-copy. + * This method completes a deep-copy by creating new objects for the cloned object's internal reference pointers. + */ + public function __clone() + { + $this->headers = clone $this->headers; + $this->body = clone $this->body; + } + + /** + * {@inheritdoc} + */ + public function getMethod(): string + { + return $this->method; + } + + /** + * {@inheritdoc} + * @return static + */ + public function withMethod($method) + { + $method = $this->filterMethod($method); + $clone = clone $this; + $clone->method = $method; + + return $clone; + } + + /** + * Validate the HTTP method + * + * @param string $method + * + * @return string + * + * @throws InvalidArgumentException on invalid HTTP method. + */ + protected function filterMethod($method): string + { + /** @var mixed $method */ + if (!is_string($method)) { + throw new InvalidArgumentException(sprintf( + 'Unsupported HTTP method; must be a string, received %s', + (is_object($method) ? get_class($method) : gettype($method)) + )); + } + + if (preg_match("/^[!#$%&'*+.^_`|~0-9a-z-]+$/i", $method) !== 1) { + throw new InvalidArgumentException(sprintf( + 'Unsupported HTTP method "%s" provided', + $method + )); + } + + return $method; + } + + /** + * {@inheritdoc} + */ + public function getRequestTarget(): string + { + if ($this->requestTarget) { + return $this->requestTarget; + } + + if ($this->uri === null) { + return '/'; + } + + $path = $this->uri->getPath(); + $path = '/' . ltrim($path, '/'); + + $query = $this->uri->getQuery(); + if ($query) { + $path .= '?' . $query; + } + + return $path; + } + + /** + * {@inheritdoc} + * @return static + */ + public function withRequestTarget($requestTarget) + { + if (!is_string($requestTarget) || preg_match('#\s#', $requestTarget)) { + throw new InvalidArgumentException( + 'Invalid request target provided; must be a string and cannot contain whitespace' + ); + } + + $clone = clone $this; + $clone->requestTarget = $requestTarget; + + return $clone; + } + + /** + * {@inheritdoc} + */ + public function getUri(): UriInterface + { + return $this->uri; + } + + /** + * {@inheritdoc} + * @return static + */ + public function withUri(UriInterface $uri, $preserveHost = false) + { + $clone = clone $this; + $clone->uri = $uri; + + if (!$preserveHost && $uri->getHost() !== '') { + $clone->headers->setHeader('Host', $uri->getHost()); + return $clone; + } + + if (($uri->getHost() !== '' && !$this->hasHeader('Host') || $this->getHeaderLine('Host') === '')) { + $clone->headers->setHeader('Host', $uri->getHost()); + return $clone; + } + + return $clone; + } + + /** + * {@inheritdoc} + */ + public function getCookieParams(): array + { + return $this->cookies; + } + + /** + * {@inheritdoc} + * @return static + */ + public function withCookieParams(array $cookies) + { + $clone = clone $this; + $clone->cookies = $cookies; + + return $clone; + } + + /** + * {@inheritdoc} + */ + public function getQueryParams(): array + { + if (is_array($this->queryParams)) { + return $this->queryParams; + } + + if ($this->uri === null) { + return []; + } + + parse_str($this->uri->getQuery(), $this->queryParams); // <-- URL decodes data + assert(is_array($this->queryParams)); + + return $this->queryParams; + } + + /** + * {@inheritdoc} + * @return static + */ + public function withQueryParams(array $query) + { + $clone = clone $this; + $clone->queryParams = $query; + + return $clone; + } + + /** + * {@inheritdoc} + */ + public function getUploadedFiles(): array + { + return $this->uploadedFiles; + } + + /** + * {@inheritdoc} + * @return static + */ + public function withUploadedFiles(array $uploadedFiles) + { + $clone = clone $this; + $clone->uploadedFiles = $uploadedFiles; + + return $clone; + } + + /** + * {@inheritdoc} + */ + public function getServerParams(): array + { + return $this->serverParams; + } + + /** + * {@inheritdoc} + */ + public function getAttributes(): array + { + return $this->attributes; + } + + /** + * {@inheritdoc} + * @return mixed + */ + public function getAttribute($name, $default = null) + { + return $this->attributes[$name] ?? $default; + } + + /** + * {@inheritdoc} + * @return static + */ + public function withAttribute($name, $value) + { + $clone = clone $this; + $clone->attributes[$name] = $value; + + return $clone; + } + + /** + * {@inheritdoc} + * @return static + */ + public function withoutAttribute($name) + { + $clone = clone $this; + + unset($clone->attributes[$name]); + + return $clone; + } + + /** + * {@inheritdoc} + */ + public function getParsedBody() + { + return $this->parsedBody; + } + + /** + * {@inheritdoc} + * @return static + */ + public function withParsedBody($data) + { + /** @var mixed $data */ + if (!is_null($data) && !is_object($data) && !is_array($data)) { + throw new InvalidArgumentException('Parsed body value must be an array, an object, or null'); + } + + $clone = clone $this; + $clone->parsedBody = $data; + + return $clone; + } +} diff --git a/vendor/slim/psr7/src/Response.php b/vendor/slim/psr7/src/Response.php new file mode 100644 index 00000000..c6d4c6eb --- /dev/null +++ b/vendor/slim/psr7/src/Response.php @@ -0,0 +1,216 @@ + 'Continue', + StatusCodeInterface::STATUS_SWITCHING_PROTOCOLS => 'Switching Protocols', + StatusCodeInterface::STATUS_PROCESSING => 'Processing', + + // Successful 2xx + StatusCodeInterface::STATUS_OK => 'OK', + StatusCodeInterface::STATUS_CREATED => 'Created', + StatusCodeInterface::STATUS_ACCEPTED => 'Accepted', + StatusCodeInterface::STATUS_NON_AUTHORITATIVE_INFORMATION => 'Non-Authoritative Information', + StatusCodeInterface::STATUS_NO_CONTENT => 'No Content', + StatusCodeInterface::STATUS_RESET_CONTENT => 'Reset Content', + StatusCodeInterface::STATUS_PARTIAL_CONTENT => 'Partial Content', + StatusCodeInterface::STATUS_MULTI_STATUS => 'Multi-Status', + StatusCodeInterface::STATUS_ALREADY_REPORTED => 'Already Reported', + StatusCodeInterface::STATUS_IM_USED => 'IM Used', + + // Redirection 3xx + StatusCodeInterface::STATUS_MULTIPLE_CHOICES => 'Multiple Choices', + StatusCodeInterface::STATUS_MOVED_PERMANENTLY => 'Moved Permanently', + StatusCodeInterface::STATUS_FOUND => 'Found', + StatusCodeInterface::STATUS_SEE_OTHER => 'See Other', + StatusCodeInterface::STATUS_NOT_MODIFIED => 'Not Modified', + StatusCodeInterface::STATUS_USE_PROXY => 'Use Proxy', + StatusCodeInterface::STATUS_RESERVED => '(Unused)', + StatusCodeInterface::STATUS_TEMPORARY_REDIRECT => 'Temporary Redirect', + StatusCodeInterface::STATUS_PERMANENT_REDIRECT => 'Permanent Redirect', + + // Client Error 4xx + StatusCodeInterface::STATUS_BAD_REQUEST => 'Bad Request', + StatusCodeInterface::STATUS_UNAUTHORIZED => 'Unauthorized', + StatusCodeInterface::STATUS_PAYMENT_REQUIRED => 'Payment Required', + StatusCodeInterface::STATUS_FORBIDDEN => 'Forbidden', + StatusCodeInterface::STATUS_NOT_FOUND => 'Not Found', + StatusCodeInterface::STATUS_METHOD_NOT_ALLOWED => 'Method Not Allowed', + StatusCodeInterface::STATUS_NOT_ACCEPTABLE => 'Not Acceptable', + StatusCodeInterface::STATUS_PROXY_AUTHENTICATION_REQUIRED => 'Proxy Authentication Required', + StatusCodeInterface::STATUS_REQUEST_TIMEOUT => 'Request Timeout', + StatusCodeInterface::STATUS_CONFLICT => 'Conflict', + StatusCodeInterface::STATUS_GONE => 'Gone', + StatusCodeInterface::STATUS_LENGTH_REQUIRED => 'Length Required', + StatusCodeInterface::STATUS_PRECONDITION_FAILED => 'Precondition Failed', + StatusCodeInterface::STATUS_PAYLOAD_TOO_LARGE => 'Request Entity Too Large', + StatusCodeInterface::STATUS_URI_TOO_LONG => 'Request-URI Too Long', + StatusCodeInterface::STATUS_UNSUPPORTED_MEDIA_TYPE => 'Unsupported Media Type', + StatusCodeInterface::STATUS_RANGE_NOT_SATISFIABLE => 'Requested Range Not Satisfiable', + StatusCodeInterface::STATUS_EXPECTATION_FAILED => 'Expectation Failed', + StatusCodeInterface::STATUS_IM_A_TEAPOT => 'I\'m a teapot', + StatusCodeInterface::STATUS_MISDIRECTED_REQUEST => 'Misdirected Request', + StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY => 'Unprocessable Entity', + StatusCodeInterface::STATUS_LOCKED => 'Locked', + StatusCodeInterface::STATUS_FAILED_DEPENDENCY => 'Failed Dependency', + StatusCodeInterface::STATUS_UPGRADE_REQUIRED => 'Upgrade Required', + StatusCodeInterface::STATUS_PRECONDITION_REQUIRED => 'Precondition Required', + StatusCodeInterface::STATUS_TOO_MANY_REQUESTS => 'Too Many Requests', + StatusCodeInterface::STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE => 'Request Header Fields Too Large', + 444 => 'Connection Closed Without Response', + StatusCodeInterface::STATUS_UNAVAILABLE_FOR_LEGAL_REASONS => 'Unavailable For Legal Reasons', + 499 => 'Client Closed Request', + + // Server Error 5xx + StatusCodeInterface::STATUS_INTERNAL_SERVER_ERROR => 'Internal Server Error', + StatusCodeInterface::STATUS_NOT_IMPLEMENTED => 'Not Implemented', + StatusCodeInterface::STATUS_BAD_GATEWAY => 'Bad Gateway', + StatusCodeInterface::STATUS_SERVICE_UNAVAILABLE => 'Service Unavailable', + StatusCodeInterface::STATUS_GATEWAY_TIMEOUT => 'Gateway Timeout', + StatusCodeInterface::STATUS_VERSION_NOT_SUPPORTED => 'HTTP Version Not Supported', + StatusCodeInterface::STATUS_VARIANT_ALSO_NEGOTIATES => 'Variant Also Negotiates', + StatusCodeInterface::STATUS_INSUFFICIENT_STORAGE => 'Insufficient Storage', + StatusCodeInterface::STATUS_LOOP_DETECTED => 'Loop Detected', + StatusCodeInterface::STATUS_NOT_EXTENDED => 'Not Extended', + StatusCodeInterface::STATUS_NETWORK_AUTHENTICATION_REQUIRED => 'Network Authentication Required', + 599 => 'Network Connect Timeout Error', + ]; + + /** + * @param int $status The response status code. + * @param HeadersInterface|null $headers The response headers. + * @param StreamInterface|null $body The response body. + */ + public function __construct( + int $status = StatusCodeInterface::STATUS_OK, + ?HeadersInterface $headers = null, + ?StreamInterface $body = null + ) { + $this->status = $this->filterStatus($status); + $this->headers = $headers ?: new Headers([], []); + $this->body = $body ?: (new StreamFactory())->createStream(); + } + + /** + * This method is applied to the cloned object after PHP performs an initial shallow-copy. + * This method completes a deep-copy by creating new objects for the cloned object's internal reference pointers. + */ + public function __clone() + { + $this->headers = clone $this->headers; + } + + /** + * {@inheritdoc} + */ + public function getStatusCode(): int + { + return $this->status; + } + + /** + * {@inheritdoc} + * @return static + */ + public function withStatus($code, $reasonPhrase = '') + { + $code = $this->filterStatus($code); + $reasonPhrase = $this->filterReasonPhrase($reasonPhrase); + + $clone = clone $this; + $clone->status = $code; + $clone->reasonPhrase = $reasonPhrase; + + return $clone; + } + + /** + * {@inheritdoc} + */ + public function getReasonPhrase(): string + { + if ($this->reasonPhrase !== '') { + return $this->reasonPhrase; + } + + if (isset(static::$messages[$this->status])) { + return static::$messages[$this->status]; + } + + return ''; + } + + /** + * Filter HTTP status code. + * + * @param int $status HTTP status code. + * + * @return int + * + * @throws InvalidArgumentException If an invalid HTTP status code is provided. + */ + protected function filterStatus($status): int + { + if (!is_integer($status) || $status < StatusCodeInterface::STATUS_CONTINUE || $status > 599) { + throw new InvalidArgumentException('Invalid HTTP status code.'); + } + + return $status; + } + + /** + * Filter Reason Phrase + * + * @param mixed $reasonPhrase + * + * @return string + * + * @throws InvalidArgumentException + */ + protected function filterReasonPhrase($reasonPhrase = ''): string + { + if (is_object($reasonPhrase) && method_exists($reasonPhrase, '__toString')) { + $reasonPhrase = (string) $reasonPhrase; + } + + if (!is_string($reasonPhrase)) { + throw new InvalidArgumentException('Response reason phrase must be a string.'); + } + + if (strpos($reasonPhrase, "\r") !== false || strpos($reasonPhrase, "\n") !== false) { + throw new InvalidArgumentException( + 'Reason phrase contains one of the following prohibited characters: \r \n' + ); + } + + return $reasonPhrase; + } +} diff --git a/vendor/slim/psr7/src/Stream.php b/vendor/slim/psr7/src/Stream.php new file mode 100644 index 00000000..9de66859 --- /dev/null +++ b/vendor/slim/psr7/src/Stream.php @@ -0,0 +1,396 @@ +attach($stream); + + if ($cache && (!$cache->isSeekable() || !$cache->isWritable())) { + throw new RuntimeException('Cache stream must be seekable and writable'); + } + $this->cache = $cache; + } + + /** + * {@inheritdoc} + * @return array|mixed + */ + public function getMetadata($key = null) + { + if (!$this->stream) { + return null; + } + + $this->meta = stream_get_meta_data($this->stream); + + if (!$key) { + return $this->meta; + } + + return $this->meta[$key] ?? null; + } + + /** + * Attach new resource to this object. + * + * @internal This method is not part of the PSR-7 standard. + * + * @param resource $stream A PHP resource handle. + * + * @throws InvalidArgumentException If argument is not a valid PHP resource. + * + * @return void + */ + protected function attach($stream): void + { + if (!is_resource($stream)) { + throw new InvalidArgumentException(__METHOD__ . ' argument must be a valid PHP resource'); + } + + if ($this->stream) { + $this->detach(); + } + + $this->stream = $stream; + } + + /** + * {@inheritdoc} + */ + public function detach() + { + $oldResource = $this->stream; + $this->stream = null; + $this->meta = null; + $this->readable = null; + $this->writable = null; + $this->seekable = null; + $this->size = null; + $this->isPipe = null; + + $this->cache = null; + $this->finished = false; + + return $oldResource; + } + + /** + * {@inheritdoc} + */ + public function __toString(): string + { + if (!$this->stream) { + return ''; + } + if ($this->cache && $this->finished) { + $this->cache->rewind(); + return $this->cache->getContents(); + } + if ($this->isSeekable()) { + $this->rewind(); + } + return $this->getContents(); + } + + /** + * {@inheritdoc} + */ + public function close(): void + { + if ($this->stream) { + if ($this->isPipe()) { + pclose($this->stream); + } else { + fclose($this->stream); + } + } + + $this->detach(); + } + + /** + * {@inheritdoc} + */ + public function getSize(): ?int + { + if ($this->stream && !$this->size) { + $stats = fstat($this->stream); + + if ($stats) { + $this->size = !$this->isPipe() ? $stats['size'] : null; + } + } + + return $this->size; + } + + /** + * {@inheritdoc} + */ + public function tell(): int + { + $position = false; + + if ($this->stream) { + $position = ftell($this->stream); + } + + if ($position === false || $this->isPipe()) { + throw new RuntimeException('Could not get the position of the pointer in stream.'); + } + + return $position; + } + + /** + * {@inheritdoc} + */ + public function eof(): bool + { + return !$this->stream || feof($this->stream); + } + + /** + * {@inheritdoc} + */ + public function isReadable(): bool + { + if ($this->readable !== null) { + return $this->readable; + } + + $this->readable = false; + + if ($this->stream) { + $mode = $this->getMetadata('mode'); + + if (is_string($mode) && (strstr($mode, 'r') !== false || strstr($mode, '+') !== false)) { + $this->readable = true; + } + } + + return $this->readable; + } + + /** + * {@inheritdoc} + */ + public function isWritable(): bool + { + if ($this->writable === null) { + $this->writable = false; + + if ($this->stream) { + $mode = $this->getMetadata('mode'); + + if (is_string($mode) && (strstr($mode, 'w') !== false || strstr($mode, '+') !== false)) { + $this->writable = true; + } + } + } + + return $this->writable; + } + + /** + * {@inheritdoc} + */ + public function isSeekable(): bool + { + if ($this->seekable === null) { + $this->seekable = false; + + if ($this->stream) { + $this->seekable = !$this->isPipe() && $this->getMetadata('seekable'); + } + } + + return $this->seekable; + } + + /** + * {@inheritdoc} + */ + public function seek($offset, $whence = SEEK_SET): void + { + if (!$this->isSeekable() || $this->stream && fseek($this->stream, $offset, $whence) === -1) { + throw new RuntimeException('Could not seek in stream.'); + } + } + + /** + * {@inheritdoc} + */ + public function rewind(): void + { + if (!$this->isSeekable() || $this->stream && rewind($this->stream) === false) { + throw new RuntimeException('Could not rewind stream.'); + } + } + + /** + * {@inheritdoc} + */ + public function read($length): string + { + $data = false; + + if ($this->isReadable() && $this->stream && $length >= 0) { + $data = fread($this->stream, $length); + } + + if (is_string($data)) { + if ($this->cache) { + $this->cache->write($data); + } + if ($this->eof()) { + $this->finished = true; + } + return $data; + } + + throw new RuntimeException('Could not read from stream.'); + } + + /** + * {@inheritdoc} + * @return int + */ + public function write($string) + { + $written = false; + + if ($this->isWritable() && $this->stream) { + $written = fwrite($this->stream, $string); + } + + if ($written !== false) { + $this->size = null; + return $written; + } + + throw new RuntimeException('Could not write to stream.'); + } + + /** + * {@inheritdoc} + */ + public function getContents(): string + { + if ($this->cache && $this->finished) { + $this->cache->rewind(); + return $this->cache->getContents(); + } + + $contents = false; + + if ($this->stream) { + $contents = stream_get_contents($this->stream); + } + + if (is_string($contents)) { + if ($this->cache) { + $this->cache->write($contents); + } + if ($this->eof()) { + $this->finished = true; + } + return $contents; + } + + throw new RuntimeException('Could not get contents of stream.'); + } + + /** + * Returns whether or not the stream is a pipe. + * + * @internal This method is not part of the PSR-7 standard. + * + * @return bool + */ + public function isPipe(): bool + { + if ($this->isPipe === null) { + $this->isPipe = false; + + if ($this->stream) { + $stats = fstat($this->stream); + + if (is_array($stats)) { + $this->isPipe = ($stats['mode'] & self::FSTAT_MODE_S_IFIFO) !== 0; + } + } + } + + return $this->isPipe; + } +} diff --git a/vendor/slim/psr7/src/UploadedFile.php b/vendor/slim/psr7/src/UploadedFile.php new file mode 100644 index 00000000..b0c4df5b --- /dev/null +++ b/vendor/slim/psr7/src/UploadedFile.php @@ -0,0 +1,279 @@ +getMetadata('uri'); + if (!is_string($file)) { + throw new InvalidArgumentException('No URI associated with the stream.'); + } + $this->file = $file; + $this->stream = $fileNameOrStream; + } elseif (is_string($fileNameOrStream)) { + $this->file = $fileNameOrStream; + } else { + throw new InvalidArgumentException( + 'Please provide a string (full path to the uploaded file) or an instance of StreamInterface.' + ); + } + $this->name = $name; + $this->type = $type; + $this->size = $size; + $this->error = $error; + $this->sapi = $sapi; + } + + /** + * {@inheritdoc} + * @return StreamInterface + */ + public function getStream() + { + if ($this->moved) { + throw new RuntimeException(sprintf('Uploaded file %s has already been moved', $this->name)); + } + + if (!$this->stream) { + $this->stream = (new StreamFactory())->createStreamFromFile($this->file); + } + + return $this->stream; + } + + /** + * {@inheritdoc} + */ + public function moveTo($targetPath): void + { + if ($this->moved) { + throw new RuntimeException('Uploaded file already moved'); + } + + $targetIsStream = strpos($targetPath, '://') > 0; + if (!$targetIsStream && !is_writable(dirname($targetPath))) { + throw new InvalidArgumentException('Upload target path is not writable'); + } + + if ($targetIsStream) { + if (!copy($this->file, $targetPath)) { + throw new RuntimeException(sprintf('Error moving uploaded file %s to %s', $this->name, $targetPath)); + } + + if (!unlink($this->file)) { + throw new RuntimeException(sprintf('Error removing uploaded file %s', $this->name)); + } + } elseif ($this->sapi) { + if (!is_uploaded_file($this->file)) { + throw new RuntimeException(sprintf('%s is not a valid uploaded file', $this->file)); + } + + if (!move_uploaded_file($this->file, $targetPath)) { + throw new RuntimeException(sprintf('Error moving uploaded file %s to %s', $this->name, $targetPath)); + } + } else { + if (!rename($this->file, $targetPath)) { + throw new RuntimeException(sprintf('Error moving uploaded file %s to %s', $this->name, $targetPath)); + } + } + + $this->moved = true; + } + + /** + * {@inheritdoc} + */ + public function getError(): int + { + return $this->error; + } + + /** + * {@inheritdoc} + */ + public function getClientFilename(): ?string + { + return $this->name; + } + + /** + * {@inheritdoc} + */ + public function getClientMediaType(): ?string + { + return $this->type; + } + + /** + * {@inheritdoc} + */ + public function getSize(): ?int + { + return $this->size; + } + + /** + * Returns the client-provided full path to the file + * + * @internal This method is not part of the PSR-7 standard + * + * @return string + */ + public function getFilePath(): string + { + return $this->file; + } + + /** + * Create a normalized tree of UploadedFile instances from the Environment. + * + * @internal This method is not part of the PSR-7 standard. + * + * @param array $globals The global server variables. + * + * @return array A normalized tree of UploadedFile instances or null if none are provided. + */ + public static function createFromGlobals(array $globals): array + { + if (isset($globals['slim.files']) && is_array($globals['slim.files'])) { + return $globals['slim.files']; + } + + if (!empty($_FILES)) { + return self::parseUploadedFiles($_FILES); + } + + return []; + } + + /** + * Parse a non-normalized, i.e. $_FILES superglobal, tree of uploaded file data. + * + * @internal This method is not part of the PSR-7 standard. + * + * @param array $uploadedFiles The non-normalized tree of uploaded file data. + * + * @return array A normalized tree of UploadedFile instances. + */ + private static function parseUploadedFiles(array $uploadedFiles): array + { + $parsed = []; + foreach ($uploadedFiles as $field => $uploadedFile) { + if (!isset($uploadedFile['error'])) { + if (is_array($uploadedFile)) { + $parsed[$field] = self::parseUploadedFiles($uploadedFile); + } + continue; + } + + $parsed[$field] = []; + if (!is_array($uploadedFile['error'])) { + $parsed[$field] = new static( + $uploadedFile['tmp_name'], + $uploadedFile['name'] ?? null, + $uploadedFile['type'] ?? null, + $uploadedFile['size'] ?? null, + $uploadedFile['error'], + true + ); + } else { + $subArray = []; + foreach ($uploadedFile['error'] as $fileIdx => $error) { + // Normalize sub array and re-parse to move the input's key name up a level + $subArray[$fileIdx]['name'] = $uploadedFile['name'][$fileIdx]; + $subArray[$fileIdx]['type'] = $uploadedFile['type'][$fileIdx]; + $subArray[$fileIdx]['tmp_name'] = $uploadedFile['tmp_name'][$fileIdx]; + $subArray[$fileIdx]['error'] = $uploadedFile['error'][$fileIdx]; + $subArray[$fileIdx]['size'] = $uploadedFile['size'][$fileIdx]; + + $parsed[$field] = self::parseUploadedFiles($subArray); + } + } + } + + return $parsed; + } +} diff --git a/vendor/slim/psr7/src/Uri.php b/vendor/slim/psr7/src/Uri.php new file mode 100644 index 00000000..b43aa549 --- /dev/null +++ b/vendor/slim/psr7/src/Uri.php @@ -0,0 +1,494 @@ + null, + 'http' => 80, + 'https' => 443 + ]; + + /** + * Uri scheme (without "://" suffix) + */ + protected string $scheme = ''; + + protected string $user = ''; + + protected string $password = ''; + + protected string $host = ''; + + protected ?int $port; + + protected string $path = ''; + + /** + * Uri query string (without "?" prefix) + */ + protected string $query = ''; + + /** + * Uri fragment string (without "#" prefix) + */ + protected string $fragment = ''; + + /** + * @param string $scheme Uri scheme. + * @param string $host Uri host. + * @param int|null $port Uri port number. + * @param string $path Uri path. + * @param string $query Uri query string. + * @param string $fragment Uri fragment. + * @param string $user Uri user. + * @param string $password Uri password. + */ + public function __construct( + string $scheme, + string $host, + ?int $port = null, + string $path = '/', + string $query = '', + string $fragment = '', + string $user = '', + string $password = '' + ) { + $this->scheme = $this->filterScheme($scheme); + $this->host = $this->filterHost($host); + $this->port = $this->filterPort($port); + $this->path = $this->filterPath($path); + $this->query = $this->filterQuery($query); + $this->fragment = $this->filterFragment($fragment); + $this->user = $this->filterUserInfo($user); + $this->password = $this->filterUserInfo($password); + } + + /** + * {@inheritdoc} + */ + public function getScheme(): string + { + return $this->scheme; + } + + /** + * {@inheritdoc} + * @return static + */ + public function withScheme($scheme) + { + $scheme = $this->filterScheme($scheme); + $clone = clone $this; + $clone->scheme = $scheme; + + return $clone; + } + + /** + * Filter Uri scheme. + * + * @param mixed $scheme Raw Uri scheme. + * + * @return string + * + * @throws InvalidArgumentException If the Uri scheme is not a string. + * @throws InvalidArgumentException If Uri scheme is not exists in SUPPORTED_SCHEMES + */ + protected function filterScheme($scheme): string + { + if (!is_string($scheme)) { + throw new InvalidArgumentException('Uri scheme must be a string.'); + } + + $scheme = str_replace('://', '', strtolower($scheme)); + if (!key_exists($scheme, static::SUPPORTED_SCHEMES)) { + throw new InvalidArgumentException( + 'Uri scheme must be one of: "' . implode('", "', array_keys(static::SUPPORTED_SCHEMES)) . '"' + ); + } + + return $scheme; + } + + /** + * {@inheritdoc} + */ + public function getAuthority(): string + { + $userInfo = $this->getUserInfo(); + $host = $this->getHost(); + $port = $this->getPort(); + + return ($userInfo !== '' ? $userInfo . '@' : '') . $host . ($port !== null ? ':' . $port : ''); + } + + /** + * {@inheritdoc} + */ + public function getUserInfo(): string + { + $info = $this->user; + + if ($this->password !== '') { + $info .= ':' . $this->password; + } + + return $info; + } + + /** + * {@inheritdoc} + * @return static + */ + public function withUserInfo($user, $password = null) + { + $clone = clone $this; + $clone->user = $this->filterUserInfo($user); + + if ($clone->user !== '') { + $clone->password = $this->filterUserInfo($password); + } else { + $clone->password = ''; + } + + return $clone; + } + + /** + * Filters the user info string. + * + * Returns the percent-encoded query string. + * + * @param string|null $info The raw uri query string. + * + * @return string + */ + protected function filterUserInfo(?string $info = null): string + { + if (!is_string($info)) { + return ''; + } + + $match = preg_replace_callback( + '/(?:[^a-zA-Z0-9_\-\.~!\$&\'\(\)\*\+,;=]+|%(?![A-Fa-f0-9]{2}))/u', + function ($match) { + return rawurlencode($match[0]); + }, + $info + ); + + return is_string($match) ? $match : ''; + } + + /** + * {@inheritdoc} + */ + public function getHost(): string + { + return $this->host; + } + + /** + * {@inheritdoc} + * @return static + */ + public function withHost($host) + { + $clone = clone $this; + $clone->host = $this->filterHost($host); + + return $clone; + } + + /** + * Filter Uri host. + * + * If the supplied host is an IPv6 address, then it is converted to a reference + * as per RFC 2373. + * + * @param mixed $host The host to filter. + * + * @return string + * + * @throws InvalidArgumentException for invalid host names. + */ + protected function filterHost($host): string + { + if (is_object($host) && method_exists($host, '__toString')) { + $host = (string) $host; + } + + if (!is_string($host)) { + throw new InvalidArgumentException('Uri host must be a string'); + } + + if (filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { + $host = '[' . $host . ']'; + } + + return strtolower($host); + } + + /** + * {@inheritdoc} + */ + public function getPort(): ?int + { + return $this->port && !$this->hasStandardPort() ? $this->port : null; + } + + /** + * {@inheritdoc} + * @return static + */ + public function withPort($port) + { + $port = $this->filterPort($port); + $clone = clone $this; + $clone->port = $port; + + return $clone; + } + + /** + * Does this Uri use a standard port? + * + * @return bool + */ + protected function hasStandardPort(): bool + { + return static::SUPPORTED_SCHEMES[$this->scheme] === $this->port; + } + + /** + * Filter Uri port. + * + * @param int|null $port The Uri port number. + * + * @return int|null + * + * @throws InvalidArgumentException If the port is invalid. + */ + protected function filterPort($port): ?int + { + if (is_null($port) || (is_integer($port) && ($port >= 1 && $port <= 65535))) { + return $port; + } + + throw new InvalidArgumentException('Uri port must be null or an integer between 1 and 65535 (inclusive)'); + } + + /** + * {@inheritdoc} + */ + public function getPath(): string + { + return $this->path; + } + + /** + * {@inheritdoc} + * @return static + */ + public function withPath($path) + { + if (!is_string($path)) { + throw new InvalidArgumentException('Uri path must be a string'); + } + + $clone = clone $this; + $clone->path = $this->filterPath($path); + + return $clone; + } + + /** + * Filter Uri path. + * + * This method percent-encodes all reserved characters in the provided path string. + * This method will NOT double-encode characters that are already percent-encoded. + * + * @param string $path The raw uri path. + * + * @return string The RFC 3986 percent-encoded uri path. + * + * @link http://www.faqs.org/rfcs/rfc3986.html + */ + protected function filterPath($path): string + { + $match = preg_replace_callback( + '/(?:[^a-zA-Z0-9_\-\.~:@&=\+\$,\/;%]+|%(?![A-Fa-f0-9]{2}))/', + function ($match) { + return rawurlencode($match[0]); + }, + $path + ); + + return is_string($match) ? $match : ''; + } + + /** + * {@inheritdoc} + */ + public function getQuery(): string + { + return $this->query; + } + + /** + * {@inheritdoc} + * @return static + */ + public function withQuery($query) + { + $query = ltrim($this->filterQuery($query), '?'); + $clone = clone $this; + $clone->query = $query; + + return $clone; + } + + /** + * Filters the query string of a URI. + * + * Returns the percent-encoded query string. + * + * @param mixed $query The raw uri query string. + * + * @return string + */ + protected function filterQuery($query): string + { + if (is_object($query) && method_exists($query, '__toString')) { + $query = (string) $query; + } + + if (!is_string($query)) { + throw new InvalidArgumentException('Uri query must be a string.'); + } + + $match = preg_replace_callback( + '/(?:[^a-zA-Z0-9_\-\.~!\$&\'\(\)\*\+,;=%:@\/\?]+|%(?![A-Fa-f0-9]{2}))/', + function ($match) { + return rawurlencode($match[0]); + }, + $query + ); + + return is_string($match) ? $match : ''; + } + + /** + * {@inheritdoc} + */ + public function getFragment(): string + { + return $this->fragment; + } + + /** + * {@inheritdoc} + * @return static + */ + public function withFragment($fragment) + { + $fragment = $this->filterFragment($fragment); + $clone = clone $this; + $clone->fragment = $fragment; + + return $clone; + } + + /** + * Filters fragment of a URI. + * + * Returns the percent-encoded fragment. + * + * @param mixed $fragment The raw uri query string. + * + * @return string + */ + protected function filterFragment($fragment): string + { + if (is_object($fragment) && method_exists($fragment, '__toString')) { + $fragment = (string) $fragment; + } + + if (!is_string($fragment)) { + throw new InvalidArgumentException('Uri fragment must be a string.'); + } + + $fragment = ltrim($fragment, '#'); + + $match = preg_replace_callback( + '/(?:[^a-zA-Z0-9_\-\.~!\$&\'\(\)\*\+,;=%:@\/\?]+|%(?![A-Fa-f0-9]{2}))/', + function ($match) { + return rawurlencode($match[0]); + }, + $fragment + ); + + return is_string($match) ? $match : ''; + } + + /** + * {@inheritdoc} + */ + public function __toString(): string + { + $scheme = $this->getScheme(); + $authority = $this->getAuthority(); + $path = $this->getPath(); + $query = $this->getQuery(); + $fragment = $this->getFragment(); + + if ($path !== '') { + if ($path[0] !== '/') { + if ($authority !== '') { + // If the path is rootless and an authority is present, the path MUST be prefixed by "/". + $path = '/' . $path; + } + } elseif (isset($path[1]) && $path[1] === '/') { + if ($authority === '') { + // If the path is starting with more than one "/" and no authority is present, + // the starting slashes MUST be reduced to one. + $path = '/' . ltrim($path, '/'); + } + } + } + + return ($scheme !== '' ? $scheme . ':' : '') + . ($authority !== '' ? '//' . $authority : '') + . $path + . ($query !== '' ? '?' . $query : '') + . ($fragment !== '' ? '#' . $fragment : ''); + } +} diff --git a/vendor/symfony/polyfill-php80/LICENSE b/vendor/symfony/polyfill-php80/LICENSE new file mode 100644 index 00000000..5593b1d8 --- /dev/null +++ b/vendor/symfony/polyfill-php80/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2020 Fabien Potencier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/symfony/polyfill-php80/Php80.php b/vendor/symfony/polyfill-php80/Php80.php new file mode 100644 index 00000000..362dd1a9 --- /dev/null +++ b/vendor/symfony/polyfill-php80/Php80.php @@ -0,0 +1,115 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Php80; + +/** + * @author Ion Bazan + * @author Nico Oelgart + * @author Nicolas Grekas + * + * @internal + */ +final class Php80 +{ + public static function fdiv(float $dividend, float $divisor): float + { + return @($dividend / $divisor); + } + + public static function get_debug_type($value): string + { + switch (true) { + case null === $value: return 'null'; + case \is_bool($value): return 'bool'; + case \is_string($value): return 'string'; + case \is_array($value): return 'array'; + case \is_int($value): return 'int'; + case \is_float($value): return 'float'; + case \is_object($value): break; + case $value instanceof \__PHP_Incomplete_Class: return '__PHP_Incomplete_Class'; + default: + if (null === $type = @get_resource_type($value)) { + return 'unknown'; + } + + if ('Unknown' === $type) { + $type = 'closed'; + } + + return "resource ($type)"; + } + + $class = \get_class($value); + + if (false === strpos($class, '@')) { + return $class; + } + + return (get_parent_class($class) ?: key(class_implements($class)) ?: 'class').'@anonymous'; + } + + public static function get_resource_id($res): int + { + if (!\is_resource($res) && null === @get_resource_type($res)) { + throw new \TypeError(sprintf('Argument 1 passed to get_resource_id() must be of the type resource, %s given', get_debug_type($res))); + } + + return (int) $res; + } + + public static function preg_last_error_msg(): string + { + switch (preg_last_error()) { + case \PREG_INTERNAL_ERROR: + return 'Internal error'; + case \PREG_BAD_UTF8_ERROR: + return 'Malformed UTF-8 characters, possibly incorrectly encoded'; + case \PREG_BAD_UTF8_OFFSET_ERROR: + return 'The offset did not correspond to the beginning of a valid UTF-8 code point'; + case \PREG_BACKTRACK_LIMIT_ERROR: + return 'Backtrack limit exhausted'; + case \PREG_RECURSION_LIMIT_ERROR: + return 'Recursion limit exhausted'; + case \PREG_JIT_STACKLIMIT_ERROR: + return 'JIT stack limit exhausted'; + case \PREG_NO_ERROR: + return 'No error'; + default: + return 'Unknown error'; + } + } + + public static function str_contains(string $haystack, string $needle): bool + { + return '' === $needle || false !== strpos($haystack, $needle); + } + + public static function str_starts_with(string $haystack, string $needle): bool + { + return 0 === strncmp($haystack, $needle, \strlen($needle)); + } + + public static function str_ends_with(string $haystack, string $needle): bool + { + if ('' === $needle || $needle === $haystack) { + return true; + } + + if ('' === $haystack) { + return false; + } + + $needleLength = \strlen($needle); + + return $needleLength <= \strlen($haystack) && 0 === substr_compare($haystack, $needle, -$needleLength); + } +} diff --git a/vendor/symfony/polyfill-php80/PhpToken.php b/vendor/symfony/polyfill-php80/PhpToken.php new file mode 100644 index 00000000..fe6e6910 --- /dev/null +++ b/vendor/symfony/polyfill-php80/PhpToken.php @@ -0,0 +1,103 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Php80; + +/** + * @author Fedonyuk Anton + * + * @internal + */ +class PhpToken implements \Stringable +{ + /** + * @var int + */ + public $id; + + /** + * @var string + */ + public $text; + + /** + * @var int + */ + public $line; + + /** + * @var int + */ + public $pos; + + public function __construct(int $id, string $text, int $line = -1, int $position = -1) + { + $this->id = $id; + $this->text = $text; + $this->line = $line; + $this->pos = $position; + } + + public function getTokenName(): ?string + { + if ('UNKNOWN' === $name = token_name($this->id)) { + $name = \strlen($this->text) > 1 || \ord($this->text) < 32 ? null : $this->text; + } + + return $name; + } + + /** + * @param int|string|array $kind + */ + public function is($kind): bool + { + foreach ((array) $kind as $value) { + if (\in_array($value, [$this->id, $this->text], true)) { + return true; + } + } + + return false; + } + + public function isIgnorable(): bool + { + return \in_array($this->id, [\T_WHITESPACE, \T_COMMENT, \T_DOC_COMMENT, \T_OPEN_TAG], true); + } + + public function __toString(): string + { + return (string) $this->text; + } + + /** + * @return static[] + */ + public static function tokenize(string $code, int $flags = 0): array + { + $line = 1; + $position = 0; + $tokens = token_get_all($code, $flags); + foreach ($tokens as $index => $token) { + if (\is_string($token)) { + $id = \ord($token); + $text = $token; + } else { + [$id, $text, $line] = $token; + } + $tokens[$index] = new static($id, $text, $line, $position); + $position += \strlen($text); + } + + return $tokens; + } +} diff --git a/vendor/symfony/polyfill-php80/README.md b/vendor/symfony/polyfill-php80/README.md new file mode 100644 index 00000000..3816c559 --- /dev/null +++ b/vendor/symfony/polyfill-php80/README.md @@ -0,0 +1,25 @@ +Symfony Polyfill / Php80 +======================== + +This component provides features added to PHP 8.0 core: + +- [`Stringable`](https://php.net/stringable) interface +- [`fdiv`](https://php.net/fdiv) +- [`ValueError`](https://php.net/valueerror) class +- [`UnhandledMatchError`](https://php.net/unhandledmatcherror) class +- `FILTER_VALIDATE_BOOL` constant +- [`get_debug_type`](https://php.net/get_debug_type) +- [`PhpToken`](https://php.net/phptoken) class +- [`preg_last_error_msg`](https://php.net/preg_last_error_msg) +- [`str_contains`](https://php.net/str_contains) +- [`str_starts_with`](https://php.net/str_starts_with) +- [`str_ends_with`](https://php.net/str_ends_with) +- [`get_resource_id`](https://php.net/get_resource_id) + +More information can be found in the +[main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md). + +License +======= + +This library is released under the [MIT license](LICENSE). diff --git a/vendor/symfony/polyfill-php80/Resources/stubs/Attribute.php b/vendor/symfony/polyfill-php80/Resources/stubs/Attribute.php new file mode 100644 index 00000000..2b955423 --- /dev/null +++ b/vendor/symfony/polyfill-php80/Resources/stubs/Attribute.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#[Attribute(Attribute::TARGET_CLASS)] +final class Attribute +{ + public const TARGET_CLASS = 1; + public const TARGET_FUNCTION = 2; + public const TARGET_METHOD = 4; + public const TARGET_PROPERTY = 8; + public const TARGET_CLASS_CONSTANT = 16; + public const TARGET_PARAMETER = 32; + public const TARGET_ALL = 63; + public const IS_REPEATABLE = 64; + + /** @var int */ + public $flags; + + public function __construct(int $flags = self::TARGET_ALL) + { + $this->flags = $flags; + } +} diff --git a/vendor/symfony/polyfill-php80/Resources/stubs/PhpToken.php b/vendor/symfony/polyfill-php80/Resources/stubs/PhpToken.php new file mode 100644 index 00000000..bd1212f6 --- /dev/null +++ b/vendor/symfony/polyfill-php80/Resources/stubs/PhpToken.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +if (\PHP_VERSION_ID < 80000 && extension_loaded('tokenizer')) { + class PhpToken extends Symfony\Polyfill\Php80\PhpToken + { + } +} diff --git a/vendor/symfony/polyfill-php80/Resources/stubs/Stringable.php b/vendor/symfony/polyfill-php80/Resources/stubs/Stringable.php new file mode 100644 index 00000000..7c62d750 --- /dev/null +++ b/vendor/symfony/polyfill-php80/Resources/stubs/Stringable.php @@ -0,0 +1,20 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +if (\PHP_VERSION_ID < 80000) { + interface Stringable + { + /** + * @return string + */ + public function __toString(); + } +} diff --git a/vendor/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php b/vendor/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php new file mode 100644 index 00000000..01c6c6c8 --- /dev/null +++ b/vendor/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +if (\PHP_VERSION_ID < 80000) { + class UnhandledMatchError extends Error + { + } +} diff --git a/vendor/symfony/polyfill-php80/Resources/stubs/ValueError.php b/vendor/symfony/polyfill-php80/Resources/stubs/ValueError.php new file mode 100644 index 00000000..783dbc28 --- /dev/null +++ b/vendor/symfony/polyfill-php80/Resources/stubs/ValueError.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +if (\PHP_VERSION_ID < 80000) { + class ValueError extends Error + { + } +} diff --git a/vendor/symfony/polyfill-php80/bootstrap.php b/vendor/symfony/polyfill-php80/bootstrap.php new file mode 100644 index 00000000..e5f7dbc1 --- /dev/null +++ b/vendor/symfony/polyfill-php80/bootstrap.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Symfony\Polyfill\Php80 as p; + +if (\PHP_VERSION_ID >= 80000) { + return; +} + +if (!defined('FILTER_VALIDATE_BOOL') && defined('FILTER_VALIDATE_BOOLEAN')) { + define('FILTER_VALIDATE_BOOL', \FILTER_VALIDATE_BOOLEAN); +} + +if (!function_exists('fdiv')) { + function fdiv(float $num1, float $num2): float { return p\Php80::fdiv($num1, $num2); } +} +if (!function_exists('preg_last_error_msg')) { + function preg_last_error_msg(): string { return p\Php80::preg_last_error_msg(); } +} +if (!function_exists('str_contains')) { + function str_contains(?string $haystack, ?string $needle): bool { return p\Php80::str_contains($haystack ?? '', $needle ?? ''); } +} +if (!function_exists('str_starts_with')) { + function str_starts_with(?string $haystack, ?string $needle): bool { return p\Php80::str_starts_with($haystack ?? '', $needle ?? ''); } +} +if (!function_exists('str_ends_with')) { + function str_ends_with(?string $haystack, ?string $needle): bool { return p\Php80::str_ends_with($haystack ?? '', $needle ?? ''); } +} +if (!function_exists('get_debug_type')) { + function get_debug_type($value): string { return p\Php80::get_debug_type($value); } +} +if (!function_exists('get_resource_id')) { + function get_resource_id($resource): int { return p\Php80::get_resource_id($resource); } +} diff --git a/vendor/symfony/polyfill-php80/composer.json b/vendor/symfony/polyfill-php80/composer.json new file mode 100644 index 00000000..bd9a3262 --- /dev/null +++ b/vendor/symfony/polyfill-php80/composer.json @@ -0,0 +1,40 @@ +{ + "name": "symfony/polyfill-php80", + "type": "library", + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "keywords": ["polyfill", "shim", "compatibility", "portable"], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=7.1" + }, + "autoload": { + "psr-4": { "Symfony\\Polyfill\\Php80\\": "" }, + "files": [ "bootstrap.php" ], + "classmap": [ "Resources/stubs" ] + }, + "minimum-stability": "dev", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + } +}